Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class S2widget extends WP_Widget {
- function S2widget() {
- // Instantiate the parent object
- parent::__construct(
- 's2member_user', // Base ID
- 'IDF User widget', // Name
- array( 'description' => 'Customized S2member User widget' ) // Args
- );
- }
- function widget( $args, $instance ) {
- // add check to see if buddypress and s2 member are active
- global $EM_Bookings;
- global $EM_Person;
- // global $wpdb;
- extract( $args );
- $siteurl = home_url();
- $tc_widgettitle = "My IDF";
- $EM_Person = get_current_user_id();
- // $EM_Bookings = $EM_Person->get_bookings();
- // $bookings_count = count($EM_Bookings->bookings);
- if ( $bookings_count > 0 ) {
- // if has bookings, output link to bookings page
- $registrationslink = '<br /><a href="'.$siteurl.'/my-idf/registrations/">My registrations</a>';
- // Get events here in one query to speed things up
- $event_ids = array();
- foreach ( $EM_Bookings as $EM_Booking ) {
- $event_ids[] = $EM_Booking->event_id;
- }
- }
- // Widget output
- echo $before_widget;
- if ( $tc_widgettitle ) echo $before_title . $tc_widgettitle . $after_title;
- // echo '<p>'.$EM_Person.'</p>';
- // echo '<pre>' . $EM_Person . '</pre>';
- if ( is_user_logged_in() ) {
- echo s2member_pro_login_widget( array( "title" => "", "profile_title" => "", "display_gravatar" => "1", "link_gravatar" => "0", "login_redirect" => "%%previous%%", "logout_redirect" => "%%previous%%", "signup_url" => "", "my_profile_url" => "", "my_account_url" => "", "logged_in_code" => "<a href='".$siteurl."/my-idf/profile/'>My account</a><br /><a href='".$siteurl."/my-idf/registrations/'>My registrations</a>" ) );
- } else {
- echo s2member_pro_login_widget( array( "title" => "", "profile_title" => "", "display_gravatar" => "1", "link_gravatar" => "0", "login_redirect" => "%%previous%%", "logout_redirect" => "%%previous%%", "signup_url" => "", "my_profile_url" => "", "my_account_url" => "", "logged_in_code" => "<a href='".$siteurl."/my-idf/profile/'>My account</a><br /><a href='".$siteurl."/my-idf/registrations/'>My registrations</a>" ) );
- }
- echo $after_widget;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement