myCRED hook…

This topic contains 10 replies, has 3 voices, and was last updated by  Alex Rollin 5 years, 3 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #468272

    Rodney Chatman
    Expired Member
    Post count: 89

    Hello,

    I am looking to create a hook for the myCRED plugin. I want to assign points based on ratings. What wordpress action is associated with ratings in gd? I’d like to give points based on star ratings (1 star=10pts, 2 stars=20pts, etc…). I need to know what action fires when users leave ratings and how can I get that rating value to assign points based on the rating.

    #468305

    Alex Rollin
    Moderator
    Post count: 27815

    Cool idea. I will flag your question for the developers and they will let you know if there is a way to do that asap.

    #468332

    Rodney Chatman
    Expired Member
    Post count: 89

    Being able to give points and assign badges for creating listings would be cool also. If that isn’t already possible.

    #468355

    Rodney Chatman
    Expired Member
    Post count: 89
    This reply has been marked as private.
    #468415

    Kiran
    Moderator
    Post count: 7069

    Hello Rodney,

    I need to know what action fires when users leave ratings and how can I get that rating value to assign points based on the rating.

    Use following code snippet to get rating stars value on save review.

    
    
    function gd_snippet_190212_after_save_review( $request, $text ) {
    	$rating = (float) $request['geodir_overallrating']; // rating
    	$post_id = (int) $request['comment_post_ID'];       // post id
    
    	// Do stuff here
    }
    add_action( 'geodir_after_save_comment', 'gd_snippet_190212_after_save_review', 10, 2 );

    Thanks,
    Kiran

    #468570

    Rodney Chatman
    Expired Member
    Post count: 89

    Thank you Kiran,

    I assume the value for $rating will be a numerical value 1-5, correct?

    #468624

    Kiran
    Moderator
    Post count: 7069

    Yes 🙂

    #469187

    Rodney Chatman
    Expired Member
    Post count: 89

    Hey guys,

    So I have the hook created and it is visible in myCRED and activated. When I go to a listing and leave a 5 star review, I don’t see the points awarded to the user that owns the business. In a perfect world, I’d like to see the points awarded to the specific business listing. The overall goal is to award a listing badges based on user reviews and total points for other actions. How is the users listing associated with the user? Are the two autonomous and if so how can I reference one or the other. I am also reaching out to the guys at myCRED for more info as well.

    #469251

    Alex Rollin
    Moderator
    Post count: 27815

    We are unable to provide additional support for this customization beyond the example of how to save on review.

    If you need more help with this please contact a GD Expert here:
    https://geodirectoryexperts.com/experts

    We are considering additional myCred integration for future versions. If you would like to see more hook examples you can try out our UsersWP MyCred integration here:

    https://userswp.io/docs/mycred/

    #469255

    Rodney Chatman
    Expired Member
    Post count: 89

    I kind of figured as much. I’ll probably be harassing you guys later on for more details as I begin to work closer with the guys over at MyCred.

    #469276

    Alex Rollin
    Moderator
    Post count: 27815

    We are always happy to point out hooks and filters where they exist!

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

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket