Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author myCred

    (@designbymerovingi)

    Hey.

    To save on database queries, when you first time visit a page after this hook is enabled, you receive a cookie in your browser that is valid for the amount of seconds that remains of today. So if you have either received points already for a visit you will not receive again. The same thing happens if you for example delete your log entries after receiving points and try again. As long as you have this cookie, it will not give points.

    You can either delete this cookie in your browser or try logging in with a different browser and see if you get points (assuming you have not received points today).

    I have the same problem here. After some debugging, I realized that myCRED_Hook_Site_Visits::visit is not being ever called.

    I suspect this is happening because the modules are loaded on mycred_init hook. After the module is loaded, the myCRED_Hook_Site_Visits::run is called and do the folowing:

    add_action( 'mycred_init', array( $this, 'visit' ) );

    But the mycred_init hook is already happening.

    Is that right? Running WP 3.9.1.

    Plugin Author myCred

    (@designbymerovingi)

    Hey marcobiscaro.

    Thank you for your update. I think you are right. Try changing:

    add_action( 'mycred_init', array( $this, 'visit' ) );

    to:

    add_action( 'wp_loaded', array( $this, 'visit' ) );

    Changing this calls the right method now. But there is a typo:

    PHP Fatal error: Call to undefined function apply_filter() in wp-content/plugins/mycred/modules/mycred-module-hooks.php on line 414

    Changing apply_filter to apply_filters makes everything work fine!

    Plugin Author myCred

    (@designbymerovingi)

    You are correct once again.
    Thank you for this. I have updated 1.5.1 to fix both issues.

    BUT… now the cookie is not set and it looks like the date validation is not working properly: I earned the points 57 times in some minutes.

    Plugin Author myCred

    (@designbymerovingi)

    I have not been able to figure out yet why the cookie is not being saved. I also see that the has_entry() check I am using is incorrect as $user_id and $today should switch places. I have updated 1.5.1 with a fix that has been tested to work.

    I have changed:

    if ( is_user_logged_in() && ! isset( $_COOKIE['mycred_site_visit'] ) )
    	add_action( 'mycred_init', array( $this, 'visit' ) );

    to:

    if ( is_user_logged_in() && ! isset( $_COOKIE['mycred_site_visit'] ) )
    	$this->site_visit();

    And:

    if ( $this->core->has_entry( 'site_visit', $user_id, $today, $data, $this->mycred_type ) ) return;

    with:

    if ( $this->core->has_entry( 'site_visit', $today, $user_id, $data, $this->mycred_type ) ) return;
    Thread Starter iamonlythird

    (@iamonlythird)

    Thank you both for the updates.

    I would like to implement this but I want to avoid delving into the code. What would be the best way to implement these changes? Deactivate plugin, copy & paste replace plugin files, reactivate plugin?

    Plugin Author myCred

    (@designbymerovingi)

    This is what I do:

    1. Download a fresh copy of current version.
    2. Disable current version from the Plugins page in admin area.
    3. Upload files replacing my current version via FTP.
    4. Re-enable plugin in admin area.

    THe key thing to remember not to click “Delete” the plugin in the admin area because then you will also delete your log, all point balances and your settings.

    Thank you Gabriel! It works like a charm now!

    Thread Starter iamonlythird

    (@iamonlythird)

    @gabriel I followed your instructions and it crashed my wp-admin area. White screen. Very likely an error that I could not see. Luckily I backed up the previous version and uploaded the old files back and it is working again.

    Because this was on a live site, I didn’t have a chance to properly find out what the cause of the problem was (I think errors are disabled in our production site).

    If you have the time, I would strongly suggest that you try the current version and see if it actually works, I would not be surprised if you get the same issue.

    PS. The plugin probably works for marcobiscaro2112 because he adjusted the code manually and didn’t download/replaced the plugin folder…

    Plugin Author myCred

    (@designbymerovingi)

    I have updated 1.5.1 to sort this out. I misspelled the class method name attempting to call site_visit() when it was named visits().

    Apologies for this.

    Thread Starter iamonlythird

    (@iamonlythird)

    Installed and works great so far. We have a huge userbase so I will know by tomorrow if there are any further bugs.

    Thank you for your hard work.

    Plugin Author myCred

    (@designbymerovingi)

    Thank you for letting me know. If all is well regarding this hook, please feel free to mark it Resolved.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘"Points for daily visits" doesn't work’ is closed to new replies.