Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function freerides_user_widget() {
- global $current_user, $EM_Events, $EM_Bookings, $EM_Person;
- get_currentuserinfo();
- $uid = $current_user->ID;
- ?>
- <aside id="userpanel" class="widget widget_userpanel">
- <h3 class="widget-title">Welcome <? echo $current_user->display_name; ?></h3>
- <?php
- $userpic = get_avatar( get_current_user_id(), 70 );
- if ( $userpic ) {
- ?>
- <div class="userpic"><?php echo $userpic; ?></div>
- <?php } ?>
- <ul>
- <li class=""><a href="/your-profile" title="">My profile</a></li>
- <?php
- // if user has registrations
- $EM_Person = new EM_Person( get_current_user_id() );
- $EM_Bookings = $EM_Person->get_bookings();
- $bookings_count = count($EM_Bookings->bookings);
- if ($bookings_count > 0) { ?><li class=""><a href="/events/my-registrations" title="">My registrations</a></li><?php }
- // if user has events, otherwise go to submit
- $EM_Events = EM_Events::get(array('owner'=>get_current_user_id(), 'scope'=>'all'));
- $events_count = count($EM_Events);
- ?>
- <li class=""><?php if ($events_count > 0) { ?><a href="/events/submit" title="">My events</a><?php } else { ?><a href="/events/submit/?action=edit" title="">Submit an event</a><?php } ?></li>
- <?php
- // if user has locations, otherwise hide
- $EM_Locations = EM_Locations::get(array('owner'=>get_current_user_id(), 'scope'=>'all'));
- $locations_count = count($EM_Locations);
- if ($locations_count > 0) { ?><li class=""><a href="/events/locations/edit" title="">My locations</a></li><?php } ?>
- <li class=""><a href="<?php echo wp_logout_url( get_permalink() ); ?>">Log out</a></li>
- </ul>
- <div class="clear"></div>
- </aside>
- <?php
- }
- wp_register_sidebar_widget(
- 'freerides_login_widget', // your unique widget id
- 'User panel', // widget name
- 'freerides_user_widget', // callback function
- array( // options
- 'description' => 'Widget voor user panel'
- )
- );
Add Comment
Please, Sign In to add comment