Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function freerides_user_widget() {
- global $current_user;
- 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( $uid, 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, otherwise go to shop
- global $EM_Events, $wpdb, $current_user, $EM_Notices, $EM_Person;
- $EM_Person = new EM_Person( get_current_user_id() );
- $EM_Bookings = $EM_Person->get_bookings();
- $bookings_count = count($EM_Bookings->bookings);
- ?>
- <li class=""><?php if ($bookings_count > 0) { ?><a href="/events/my-registrations" title="">My registrations</a></li>
- <?php }
- // if user has events, otherwise go to submit
- $EM_Person = new EM_Person( get_current_user_id() );
- $EM_Events = $EM_Person->get_events();
- $events_count = count($EM_Events->events);
- ?>
- <li class=""><a href="/events/submit" title="">My events</a> <?php echo $events_count; ?></li>
- <?php // if user has locations, otherwise hide
- // $EM_Locations = $EM_Person->get_locations();
- // $locs_count = count($EM_Locations->locations);
- ?>
- <li class=""><a href="/events/locations/edit" title="">My locations</a></li>
- <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