Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter Morteza Rahmani

    (@parsilinux)

    i’m so so sorry.
    it was my mistake to correctly typing close tags, due to a search & replace of post html contents using regex in npp, it removed / in close tag).
    now everything works fine.

    thank you for this great plugin.

    Thread Starter Morteza Rahmani

    (@parsilinux)

    Dear tokkonopapa
    Thank you very much for your amazing support!
    I installed latest version and now everything works like a charm (Also Gravity Forms Save/Update issue is now fixed) ??

    Array
    (
        [ip] => xxx.xxx.xxx.xxx
        [auth] => 1
        [time] => 0.004810094833374
        [provider] => IP2Location
        [code] => IR
    )

    best wishes to you.

    Thread Starter Morteza Rahmani

    (@parsilinux)

    hi.
    thanks for your time.
    i replaced your new code. now in IP Geo Block Setting & Search Tabs, i can access ip2location db and it works great.

    but in functions.php, when i try this:

    <?php
    function my_ip2location_path($path) {
        return WP_CONTENT_DIR . '/plugins/ip2location-tags/IP2LOCATION-LITE-DB5.BIN';
    }
    add_filter('ip-geo-block-ip2location-path', 'my_ip2location_path');
    if (class_exists('IP_Geo_Block')) {
    		$geolocation = IP_Geo_Block::get_geolocation($_SERVER['REMOTE_ADDR']);
    		print_r($geolocation);
    		}
    ?>

    it still returns an array without country code.

    Array
    (
        [ip] => xxx.xxx.xxx.xxx
        [auth] => 1
        [time] => 0.000348091125488
        [provider] => Cache
        [errorMessage] => not in the cache
    )

    I also tried to set Number of entries & Expiration time in Cache Settings to 0 to disable Cache. but didn’t work.

    Thread Starter Morteza Rahmani

    (@parsilinux)

    Dear tokkonopapa
    thank you for your answer & sorry for my late reply.

    I tried your code.
    after this line :

    $geolocation = IP_Geo_Block::get_geolocation( $_SERVER['REMOTE_ADDR'] );

    when i print_r($geolocation), it successfully returns an array like this:

    Array
    (
        [ip] => 2.176.231.191
        [auth] => 1
        [time] => 0.0028219223022461
        [provider] => Cache
        [errorMessage] => not in the cache
    )

    but $geolocation[‘countryCode’] returns NULL. so it doesn’t work as expected.

    Thread Starter Morteza Rahmani

    (@parsilinux)

    I found a solution to show user_url in custom user links:
    adding theme-my-login-custom.php in wp-content/plugins/
    and put these codes inside it:

    <?php
    	function add_tml_dynamic_links()
    	{
    		global $current_user;
    		get_currentuserinfo();
    		if ($current_user->user_url):
    		$userlink = $current_user->user_url;
    		endif;
    		echo '<li><a href="' . $userlink . '">your site</a></li>' . "\n";
    	}
    	add_filter('tml_user_links', 'add_tml_dynamic_links');
    ?>

    but now it appear as very first link. anyway to control the order of it? for example it appear after “Profile” link ?

    thank you very much.

    Thread Starter Morteza Rahmani

    (@parsilinux)

    sorry i put “the_author_meta” in my above example by mistake.
    i meant $current_user->user_url;

    like this one:

    <?php
      global $current_user;
      get_currentuserinfo();
      if($current_user->user_url) :
    $userlink = $current_user->user_url;
    endif;
    ?>
    Link Title: Your Site
    Link URL: <?php echo $userlink; ?>

    hi.
    i had created two custom user meta fields in my user profiles manually using functions.php in my theme. (not using ACF)

    same as my friend Shaneholden, i wanted to create custom event and logs when those meta fields change for any user.

    so i made some modifications in plugin files (which certainly is not a correct solution). but as a temporary solution, i’m going to share it with you and i hope this help.

    my custom user meta fields are two selectbox and their meta-keys are:
    1. bid_num_permit
    2. special_bid_permit

    At first i opened up UserProfile.php (pluginroot\classes\Sensors) and added these lines after line 100 (email changed condition) :

    // email changed
            if(!empty($_REQUEST['email'])){
    ...
    }
    // Line 101 - my code starts here
    $oldPermit = get_user_meta( $user_id, 'bid_num_permit', true );
    		$newPermit = trim($_REQUEST['bid_num_permit']);
    		if($oldPermit != $newPermit){
    			$this->plugin->alerts->TriggerIf(4015, array(
    				'TargetUserID' => $user_id,
    				'TargetUsername' => $user->user_login,
    				'OldPermit' => $oldPermit,
    				'NewPermit' => $newPermit,
    			), array($this, 'MustNotContainUserChanges'));
    		}
    		$oldSpecial = get_user_meta( $user_id, 'special_bid_permit', true );
    		$newSpecial = trim($_REQUEST['special_bid_permit']);
    		if($oldSpecial != $newSpecial){
    			$this->plugin->alerts->TriggerIf(4016, array(
    				'TargetUserID' => $user_id,
    				'TargetUsername' => $user->user_login,
    				'oldSpecial' => $oldSpecial,
    				'newSpecial' => $newSpecial,
    			), array($this, 'MustNotContainUserChanges'));
    		}

    as u can see, i created two new alert code for these events: 4015 & 4016.
    now for creating a custom message for these events, i opend up default.php file in plugin root and added these lines after line 123 (array(4007….):

    array(4007, E_CRITICAL, __('A user was deleted by another user', 'wp-security-audit-log'), __('Deleted User %TargetUserData->Username% with the role of %TargetUserData->Roles%', 'wp-security-audit-log')),
    array(4015, E_NOTICE, __('Special Bid Permission', 'wp-security-audit-log'), __('Number of allowed special bids for user %TargetUsername% changed from %OldPermit% to %NewPermit%.', 'wp-security-audit-log')),
    array(4016, E_NOTICE, __('Special Bid Offer Permission', 'wp-security-audit-log'), __('Permission to send offer in special bids for user %TargetUsername%, changed from %oldSpecial% to %newSpecial%.', 'wp-security-audit-log')),
    ),
    __('Plugins & Themes', 'wp-security-audit-log') => array(
    .....

    after save, it worked as i expect.
    & also those events (4015 & 4016) were automatically added in User Profiles Tab in plugin alters.

    WPWhiteSecurity, tnx for your great plugin ??

    Thread Starter Morteza Rahmani

    (@parsilinux)

    AliZee, if i correctly understand your question , what you are saying is look like having two html tags in same page… which is impossible.

    can you tell more details about what you want…?

    Thread Starter Morteza Rahmani

    (@parsilinux)

    I tested this development version (0.9.4.6) & now it works like a charm.
    Thanks Chouby. you are an amazing person ??

    Thread Starter Morteza Rahmani

    (@parsilinux)

    thanks for you reply.

    yes i checked that before.
    English is left to right & Persian is right to left.

    so if you remaded tests with same config as mine with no problems…
    i think there be some problem with “Persian WordPress” package that i installed.

    i will try to check that.

    Thread Starter Morteza Rahmani

    (@parsilinux)

    sorry. the little code i pasted above has mistakes ($mori should be $my_new_value.) here is correct one:

    $my_new_value = new Polylang_Core(); $my_new_value_lang=$my_new_value->get_current_language()->description; if($my_new_value_lang == 'en_US') $GLOBALS['wp_locale']->text_direction = 'ltr'; else $GLOBALS['wp_locale']->text_direction = 'rtl';

Viewing 11 replies - 1 through 11 (of 11 total)