Viewing 13 replies - 1 through 13 (of 13 total)
  • Philip John

    (@philipjohn)

    Hiya,

    Did you look at the suggestion Marcus provided? https://pastebin.com/mKPcdVmv

    Thanks,
    Phil

    Thread Starter siskoto

    (@siskoto)

    Well, the code that Marcus provides here is the code that is used on the demo page. It does not help me to make the attendees’ names links to their profiles.

    Philip John

    (@philipjohn)

    Ah I see.

    Then you should be able to do that by modifying the attendeeslist.php template.

    Take a look at https://wp-events-plugin.com/documentation/using-template-files/ for more on how to do that.

    Thanks,
    Phil

    Thread Starter siskoto

    (@siskoto)

    Yes, I already did that. This is the code that should be edited:

    `if($EM_Booking->booking_status == 1 && !in_array($EM_Booking->get_person()->ID, $people) ){
    $people[] = $EM_Booking->get_person()->ID;
    echo ‘<li>’. $EM_Booking->get_person()->get_name() .'</li>’;
    }elseif($EM_Booking->booking_status == 1 && $guest_bookings && $EM_Booking->get_person()->ID == $guest_booking_user ){
    echo ‘<li>’. $EM_Booking->get_person()->get_name() .'</li>’;`

    I’m new to php and I have no idea how the code should be changed.

    Plugin Support angelo_nwl

    (@angelo_nwl)

    can I know what do you mean by clickable ?

    eg.

    echo '<li><a href="domain.com">'. $EM_Booking->get_person()->get_name() .'</a></li>';

    Thread Starter siskoto

    (@siskoto)

    what I meant is that the attendees’ names should be links to their profiles. Thus it is easier for another user to decide whether to participate in an event.

    Plugin Support angelo_nwl

    (@angelo_nwl)

    I see, try this instead

    echo '<li><a href="'.get_edit_user_link( $EM_Booking->get_person()->ID ).'">'. $EM_Booking->get_person()->get_name() .'</a></li>';
    Thread Starter siskoto

    (@siskoto)

    Thanks angelo_nwl, this code worked! One more thing, can you make the link go to the profile page, not the profile edit page?

    Right now I’m opening the profile edit link:

    members/admin/profile/edit/

    and I want to open:

    members/admin/profile/

    Plugin Support angelo_nwl

    (@angelo_nwl)

    instead of

    echo '<li><a href="'.get_edit_user_link( $EM_Booking->get_person()->ID ).'">'. $EM_Booking->get_person()->get_name() .'</a></li>';

    try to change to

    echo '<li><a href="/wp-admin/profile.php?user_id="'.$EM_Booking->get_person()->ID.'>'. $EM_Booking->get_person()->get_name() .'</a></li>';
    Thread Starter siskoto

    (@siskoto)

    We are almost there. But since I’m working with buddypress I would prefer to stay in the buddypress layout instead of logging into wp-admin

    Philip John

    (@philipjohn)

    Hiya,

    You’ll need to use a BuddyPress-specific function for that. I’m not immediately aware of such a function within BuddyPress and a quick search didn’t reveal anything.

    It’d probably be worth asking on the BP forums for a function to print a profile link really.

    Thanks

    Thread Starter siskoto

    (@siskoto)

    Hey, I just managed to find the right code. Here it is:

    <?php
    /* @var $EM_Event EM_Event */
    $people = array();
    $EM_Bookings = $EM_Event->get_bookings();
    if( count($EM_Bookings->bookings) > 0 ){
    	?>
    	<ul class="event-attendees">
    	<?php
    	$guest_bookings = get_option('dbem_bookings_registration_disable');
    	$guest_booking_user = get_option('dbem_bookings_registration_user');
    	foreach( $EM_Bookings as $EM_Booking){
    if($EM_Booking->status == 1 && !in_array($EM_Booking->get_person()->ID, $people) ){
    	$people[] = $EM_Booking->get_person()->ID;
    	echo '<li><a href='.bp_core_get_user_domain( $EM_Booking->get_person()->ID ).'>'. $EM_Booking->get_person()->get_name() .'</a></li>';
    }elseif($EM_Booking->status == 1 && $guest_bookings && $EM_Booking->get_person()->ID == $guest_booking_user ){
    	echo '<li><a href='.bp_core_get_user_domain( $EM_Booking->get_person()->ID ).'>'. $EM_Booking->get_person()->get_name() .'</a></li>';
    }
    	}
    	?>
    	</ul>
    	<?php
    }

    Hope it will help others with the same issue. ??

    Cheers!

    Philip John

    (@philipjohn)

    Excellent! Thanks for sharing ??

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘making attendeeslist clickable’ is closed to new replies.