This topic has 1 reply, 2 voices, and was last updated 8 years by Andrei.

  • Author
  • #56130
     thannah
    Participant

    I added a custom button inside sweetdate-child/page-parts/buddypress-profile-header.php

    and I need it to only be on level ID 5 with pmpro. This is how my code looks

    COPY CODE
    <!-- PROFILE SECTION
    ================================================ -->
    <section>
        <div id="profile">
    
            <?php do_action('bp_before_member_home_content'); ?>
            <div class="row">
                <?php bp_get_template_part('members/single/member-header') ?>
    
            </div><!--end row-->
    
            <center><p>
    
                    <?php
                    @session_start();
                    $id = bp_loggedin_user_id();
                    if (empty($id)) {
                        unset($_SESSION['admin_user']);
                        $_SESSION['admin_user'] = array();
                    } else {
                        $_SESSION['admin_user']['id'] = bp_loggedin_user_id();
                        $_SESSION['admin_user']['type'] = 3;
                    }
    
                    global $bp;
    
                    $_SESSION['front_user']['bid'] = $bp->displayed_user->id;
    
                    if ($_SESSION['front_user']['bid'] == @$_SESSION['admin_user']['id']) {
                        ?>
                       Manage my services, prices, etc. <button onclick="window.open('https://www.salonidm.com/gzappointment/index.php?controller=GzAdmin&action=dashboard', '_blank', 'height=970,width=1000,toolbar=0,location=0,menubar=0,scrollbars=1');">Edit My Services</button>
                        <?php
                    } else {
                        ?>
                        Click button to view my schedule <button onclick="window.open('https://www.salonidm.com/gzappointment/preview.php', '_blank', 'height=970,width=1000,toolbar=0,location=0,menubar=0,scrollbars=1');">Book me now</button>
                        <?php
                    }
                    ?>
               
            </center>
    
        </div><!--end profile-->
    </section>
    <!--END PROFILE SECTION-->

    This is the code used to hide it but I have tried everything. Where do I put it?

    COPY CODE
    <!--?php 
    	if(pmpro_hasMembershipLevel('5'))
    	{
    	?-->
    	//Place your HTML or PHP code here if the user is in the required membership level
    	...
    	<!--?php 
    	}
    ?-->
    Attachments:
    You must be logged in to view attached files.
    #57879
     Andrei
    Moderator

    Hi,

    This should be the correct placement of the membership check code:

    COPY CODE
    
    <!-- PROFILE SECTION
    ================================================ -->
    <section>
        <div id="profile">
     
            <?php do_action('bp_before_member_home_content'); ?>
            <div class="row">
                <?php bp_get_template_part('members/single/member-header') ?>
     
            </div><!--end row-->
     
            <center>
     
                    <?php
                    @session_start();
                    $id = bp_loggedin_user_id();
                    if (empty($id)) {
                        unset($_SESSION['admin_user']);
                        $_SESSION['admin_user'] = array();
                    } else {
                        $_SESSION['admin_user']['id'] = bp_loggedin_user_id();
                        $_SESSION['admin_user']['type'] = 3;
                    }
     
                    global $bp;
     
                    $_SESSION['front_user']['bid'] = $bp->displayed_user->id;
    
                    if(pmpro_hasMembershipLevel('5')){
    
                    if ($_SESSION['front_user']['bid'] == @$_SESSION['admin_user']['id']) {
                        ?>
                       Manage my services, prices, etc. <button onclick="window.open('https://www.salonidm.com/gzappointment/index.php?controller=GzAdmin&action=dashboard', '_blank', 'height=970,width=1000,toolbar=0,location=0,menubar=0,scrollbars=1');">Edit My Services</button>
                        <?php
                    } else {
                        ?>
                        Click button to view my schedule <button onclick="window.open('https://www.salonidm.com/gzappointment/preview.php', '_blank', 'height=970,width=1000,toolbar=0,location=0,menubar=0,scrollbars=1');">Book me now</button>
                        <?php
                    }
                    }
                    ?>
               
            </center>
     
        </div><!--end profile-->
    </section>
    <!--END PROFILE SECTION-->
    

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 2 posts - 1 through 2 (of 2 total)

The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?