If statements and the business owner and associate property.

This topic contains 7 replies, has 3 voices, and was last updated by  Paolo 9 years ago.

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

Open Support Ticket
  • Author
    Posts
  • #39587

    urbanfix
    Expired Member
    Post count: 310

    Is it possible to write an if statement based on whether the author is the owner?
    e.g,
    If the author of the detail page is the owner and asso= yes
    Add tab to detail page
    If owner and asso= no
    dont add tab…
    Thanks,
    urbanfix

    #39591

    Simone
    Expired Member
    Post count: 3515

    Hello, that’s doable if you have some knowledge in PHP (and in wordpress) of course, you can create a function and re-set the tab array (with/without your tab) only if the author==owner. I know Im stating the obvious, this is a custom modification.
    Here it is explained how to reset a new tab array
    https://wpgeodirectory.com/support/topic/how-to-change-default-tab-from-profile-to-review/#post-31820

    you can create an IF statement for your desired/undesired tab using the claimed table in the wp_geodir_gd_place_detail table (1 or 0)

    #39640

    Paolo
    Site Admin
    Post count: 31206

    I haven’t tested, but this should do the job:

    global $post,$current_user;
    get_currentuserinfo();
    $is_owned = geodir_get_post_meta($post_id,’claimed’,true);
    if ($post->post_author == $current_user->ID && $is_owned != ‘0’) { // your function to reorder tabs here }

    Let us know how you went.

    Thanks

    #39708

    urbanfix
    Expired Member
    Post count: 310

    Hey guys, sorry for taking so long to get back to you,
    I shall try them both out and let you know how it goes!
    Thanks

    #43800

    urbanfix
    Expired Member
    Post count: 310

    Hi guys,
    I couldn’t get this to work and it wouldn’t be fit for purpose anymore!

    However, would it be possible to add the tab based on the price plan?
    Thankyou,

    #43841

    Paolo
    Site Admin
    Post count: 31206

    Try this:

    if ($post->package_id == 1 ) {// your function to reorder tabs here }

    if this doesn’t work, try:

    
    
    
    $post_package_id = geodir_get_post_meta($post_id, 'package_id');
    if ($post_package_id == 1 ) {// your function to reorder tabs here }

    Obviously make sure to change the price ID from 1 to whatever you need.

    Thanks

    #58165

    urbanfix
    Expired Member
    Post count: 310

    This was a successfully implemented!
    Please mark as resolved,
    Thanks UF

    #58189

    Paolo
    Site Admin
    Post count: 31206

    You are welcome 🙂

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

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

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount