Skip to main content
17 events
when toggle format what by license comment
Apr 5, 2019 at 11:26 comment added Qaisar Feroz Stay blessed with peace of mind and soul!
Apr 5, 2019 at 11:22 comment added Adham Mohamed Now i don't need to add any rank var inside the users list page, I'll try to call the updated ranks from that function e.g $rank = update_users_ranks(); Thanks a million @QaisarFeroz
Apr 5, 2019 at 11:20 comment added Qaisar Feroz @AdhamMohamed Yes, exactly.
Apr 5, 2019 at 11:13 comment added Adham Mohamed Aha! I got it, now every time the post is visited it will updating the the users ranks automatically, right? and i don't need to use Ajax anymore!
Apr 5, 2019 at 11:09 comment added Qaisar Feroz Remove die(); from function update_users_ranks() and add_action('wp_ajax_update_users_ranks' , 'update_users_ranks'); because we are not using ajax.
Apr 5, 2019 at 11:02 comment added Adham Mohamed Kindly check updated question, I added how the post views works, but when i call update_users_ranks() ; after update post views update_post_meta($postID, $count_key, $count); I got a blank page like error when i visit any post?
Apr 5, 2019 at 10:49 comment added Qaisar Feroz First let me know how do you update post_views_count? Do you use a plugin or your own code in single.php? If it is your own code then call your function just after the call to update_post_meta() something like this : update_post_meta( $post_id, 'post_views_count' , ++$views ); update_users_ranks() ;
Apr 5, 2019 at 10:32 comment added Adham Mohamed Thanks again helped me a lot, Kindly check the updated question, is this the right way for updating users ranks with ajax? if yes! how can i call this function into single.php to update ranks immediately when users post views increment?
Apr 5, 2019 at 9:27 comment added Qaisar Feroz Yes it is possible but i think better solution will be to create a function to update ranks e.g update_users-ranks(). And call it right after the code where you update post_views_count for a post. Anyhow, for ajax usage this tutorial may help.
Apr 5, 2019 at 7:30 comment added Adham Mohamed Just a question, is there a way to update the rank meta with ajax without visiting this page to update the ranking for all users? I don't need take much time from you, just give me a hint and I will search about to save your time, Thanks again :)
Apr 5, 2019 at 7:25 comment added Adham Mohamed You are amazing +1, Thanks so much :)
Apr 5, 2019 at 6:02 comment added Qaisar Feroz @AdhamMohamed. I have updated the answer. Now user's ranks are updated before pagination.
Apr 5, 2019 at 6:00 history edited Qaisar Feroz CC BY-SA 4.0
added 366 characters in body
Apr 4, 2019 at 19:32 comment added Adham Mohamed Hello brother @QaisarFeroz, I don't mean to bother you but i had another small issue with ranking, Now when i visit this page it should be calculate the rank for all users but not working! every time i need to load the other pages for updating the rank meta of each user :( , there are any way to update the rank meta for all users without loading the pages for updating? Thanks!
Mar 23, 2019 at 17:53 history edited Qaisar Feroz CC BY-SA 4.0
added 12 characters in body
Mar 23, 2019 at 17:22 vote accept Adham Mohamed
Mar 23, 2019 at 17:21 history answered Qaisar Feroz CC BY-SA 4.0