Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter adriandegar

    (@adriandegar)

    Figured it out, comparing with another example I came across! ??

    ` add_action( ‘add_meta_boxes’, ‘so_custom_meta_box’ );
    function so_custom_meta_box($post)
    {
    add_meta_box(‘so_meta_box’, ‘Sponsor’, ‘custom_element_grid_class_meta_box’, ‘event’, ‘normal’ , ‘core’);
    }

    add_action(‘save_post’, ‘so_save_metabox’);

    function so_save_metabox(){
    global $post;
    if(isset($_POST[“custom_element_grid_class”]))
    {
    //UPDATE:
    $meta_element_class = $_POST[‘custom_element_grid_class’];
    //END OF UPDATE
    update_post_meta($post->ID, ‘custom_element_grid_class_meta_box’, $meta_element_class);
    }
    }

    function custom_element_grid_class_meta_box($post)
    {
    $meta_element_class = get_post_meta($post->ID, ‘custom_element_grid_class_meta_box’, true); //true ensures you get just one value instead of an array
    ?>

    <?php $args = array(‘exclude’ => array(1),);
    $users = get_users( $args );

    if ($users)
    { ?>
    <select name=”custom_element_grid_class” id=”custom_element_grid_class”>
    <option value=”No Sponsor”>No Current Sponsor</option>

    <?php foreach ($users as $user)
    {
    echo “<option value=\”” .$user->ID.”\””.selected($meta_element_class, $user->ID ).”>”.$user->user_nicename.”</option>”;
    }
    ?>
    </select>
    <?php
    }
    }?> ‘

    Thread Starter adriandegar

    (@adriandegar)

    Thanks for the reply caimin_nwl, I looked into what you sent, but I don’t think that will work for my purposes.

    I need to work with the registered WP user list because elsewhere on the site I plan to have that user’s company logo display on the event, based on who is sponsoring.

    Each user has the ability to upload a company logo to their buddypress profile after registering.

    Thread Starter adriandegar

    (@adriandegar)

    Can anyone help or have any suggestions? Thank you in advance

    Thread Starter adriandegar

    (@adriandegar)

    Bump*

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