Forum Replies Created

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter ToobHed

    (@toobhed)

    Any update to the cause of my problem?

    Thread Starter ToobHed

    (@toobhed)

    Were you able to view the form? I see there was an update to the Smart Forms plugin, I have installed it but it did not resolve the error.

    Thread Starter ToobHed

    (@toobhed)

    I am having the same problem. When I try to change the location on an existing event, bot single events or those that are part of a recurrence, the forms submits without error but the location does not update.

    Can I update this manually in the database? I have several events with users booked and the only option I can come up with is to delete and recreate.

    Thanks

    Thread Starter ToobHed

    (@toobhed)

    Thanks so much, it is working now.

    Thread Starter ToobHed

    (@toobhed)

    Hmmm, I am not sure what I am doing wrong then. I have set Enable No-User Booking Mode = yes, Allow bookings with registered emails = yes in events manager settings, Allow guest bookings = no (i don’t want accounts created) and set the Available for option = everyone in the event. When viewing the event for a non-logged in user it says You must log in or register to make a booking. What could I be doing wrong?

    I am having the same problem, fresh install on two different servers and same error. Thanks for any help.

    Thread Starter ToobHed

    (@toobhed)

    Ok. Thanks for responding Justin.

    Thread Starter ToobHed

    (@toobhed)

    Yes! That did the trick, thank you for the code!

    Thread Starter ToobHed

    (@toobhed)

    I think I got it, but I went back to badgeos_get_user_earned_achievement_ids since I am using this on a members list page. The badgeos_get_user_achievements gets the id of the logged in user and that is not what I want (unless I am missing something. What I do is get the post id, then retrieve the menu_order value for that post and stick them into an array so I can sort it, then feed that array to the badgeos_get_user_earned_achievement_ids and finally output the thumbnails…a lot of this code I got from one of your other posts 🙂

    I put in some parameters so that you can specify a particular user, award type, award name, user’s nickname, and option to specify size of icon. there is also a predefined mini tag size parameter. Here it is, I am happy to hear any other suggestions but this is working at least for now 🙂

    function vets_tags_shortcode( $atts = array() ) {
    	// Parse our attributes
    	$atts = shortcode_atts( array(
    		'user' => get_current_user_id(),
    		'type' => '', //type='division-tags', 'squad-tags' etc to show BadgeOS Badge for Achievement Type with that name
                    'limit' => 100,
                    'show_name' => 0,//add the Achievement Name name to the output
                    'mini_tags' => 1, //show smaller icon
    		'nickname' =>1, //show user's nickname
    		'size' => 0 //anything other than 0 sets size in px
    	), $atts );
    	$output = '';
    	// Grab the user's current achievements, without duplicates
    	$achievements = array_unique( badgeos_get_user_earned_achievement_ids( $atts['user'], $atts['type'] ) );
    	// Setup a counter
    	$count = 0;
    	// Loop through the achievements
    	if ( ! empty( $achievements ) ) {
    		$sorted_awards = array();
    		//get the menu_order value and the achievement id and put them into an array for sorting
    		foreach( $achievements as $ach_id ) {
    			$thispost = get_post($ach_id);
    			$menu_order = $thispost->menu_order;
    			$sorted_awards[$menu_order] = $ach_id;
    		}
    		//sort the array so lowest numerical value in menu_order shows first
    		ksort($sorted_awards);
    		foreach ($sorted_awards as $order => $achievement_id) {
    			// If we've hit our limit, quit
    			if ( $count >= $atts['limit'] ) {
    				break;
    			}
    		// Output our achievement image and title
    		if (absint($atts['size']) <> 0){
    			$output .= badgeos_get_achievement_post_thumbnail( $achievement_id, array( $atts['size'], $atts['size'] ), "avatar" );
    		}elseif ($atts['mini_tags'] == 1 && absint($atts['size']) == 0){
    			//badgeos_get_achievement_post_thumbnail( $post_id = 0, $image_size = 'badgeos-achievement', $class = 'badgeos-item-thumbnail' )
                //                                                                  //array(dimensions, dimensions) "avatar" is  CSS class
    			$output .= badgeos_get_achievement_post_thumbnail( $achievement_id, array( 25, 25 ), "avatar" );
    		}else{
    			$output .= badgeos_get_achievement_post_thumbnail( $achievement_id );
    		}
    		//show tag name
    		if ($atts['show_name'] == 1){
    			$output .= '<span class="badgeos-title-wrap"> ' . str_ireplace("tags","",get_the_title( $achievement_id )) . '</span>';
    		}
    		// Increase our counter
    		$count++;
    		}
    	}
    	return $output;
    }
    add_shortcode( 'vets_tags', 'vets_tags_shortcode' );
    Thread Starter ToobHed

    (@toobhed)

    Thanks Michael,

    I am looking at the badgeos_get_user_achievements function and I have it ouputting results. How can I go about access the menu_order property? I think that would do the trick and I could use that value for the custom order.

    So I ran into the same problem as kcurlsjr, my awards were being added to the user’s profile twice. I found a fix, it might be a bit hacky so proceed with caution, I am just getting started with this plugin and need to be able to do a few things before I choose it as our solution. So I am only working with test data. I am not worried about ruining my test data, you should be cautious with your data.

    I found a function called badgeos_process_user_data in the fie user.php, it called the function badgeos_award_achievement_to_user and then it redirected afterwards.

    // Award the achievement
    badgeos_award_achievement_to_user( absint( $_GET['achievement_id'] ), absint( $_GET['user_id'] ) );
    // Redirect back to the user editor
    wp_redirect( add_query_arg( 'user_id', absint( $_GET['user_id'] ), admin_url( 'user-edit.php' ) ) );
    exit();

    So I tried the same thing and redirected back to the user list in wp-admin and it seems to be working. Here is the full function I added to my theme. I am curious to know why this works?

    function add_achievements_to_users() {
            if( isset( $_GET['action'] ) && isset( $_GET['achievement_id'] ) && isset( $_GET['users'] ) ) {
                $achievement_id = $_GET['achievement_id'];
                $users = $_GET['users'];
                foreach ( $users as $user_id ) {
    		badgeos_award_achievement_to_user(absint( $achievement_id ), absint ($user_id ));
                }
    	wp_redirect( home_url('/wp-admin/users.php') );
    	exit();
            }
            //form submission
            add_action( 'admin_footer', function() { ?>
                <script type="text/javascript" charset="utf-8">
                    jQuery("select[name='action']").append(jQuery('<option value="awardachievement">Award Achievement</option>'));
                    jQuery("#doaction").click(function(e){
                        if(jQuery("select[name='action'] :selected").val()=="awardachievement") { e.preventDefault();
                            achievementid=prompt("Enter an Achievement ID","1");
                            jQuery(".wrap form").append('<input type="hidden" name="achievement_id" value="'+achievementid+'" />').submit();
                        }
                    });
                </script>
            <?php
            });
    }

    kcurlsjr, great suggestion. This is exactly what I was looking for, I am testing it out and so far it looks promising. Thanks to you and Michael Beckwith.

    Thread Starter ToobHed

    (@toobhed)

    Thank you for responding, your advice worked for me. Just a note, I didn’t see any examples in the documentation using lt, le, gt, ge.

    For others who may find this post, this worked for me.

    [eme_if tag=’#_AVAILABLESPACES’ lt=’#_TOTALSPACES’]<p>The following people have signed up for this event:
    #_ATTENDEES</p>[/eme_if]

    Thanks Franky, this is a great plug-in!

Viewing 14 replies - 1 through 14 (of 14 total)