Support Forum ยป User Profile

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 26 total)
  • Author
    Posts
  • in reply to: Clone Field Post Select Advanced Fields #10539
    socialitysociality
    Participant

    I did that and solved it. Thanks a lot ๐Ÿ™‚

    in reply to: Media Modal does not work #8228
    socialitysociality
    Participant

    Ok,

    It worked!

    Thank you.

    in reply to: โœ…Add new user image field to new user screen #6891
    socialitysociality
    Participant

    Hello Truong,

    Unfortunately it does not seem to work, although I made the modification you mentioned.

    Any other ideas? It seems that the metabox plugin does not retrieve the image I save.

    Thank you in advance.

    in reply to: โœ…Add new user image field to new user screen #6861
    socialitysociality
    Participant

    Ok,

    You are right. Thank you. I will try it out and get back to you since there is a need.

    in reply to: โœ…Add new user image field to new user screen #6836
    socialitysociality
    Participant

    Hello,

    Yes of course.

    This is the code for declaring the meta box:

    /***********************************************************************
     * A. ADD META BOXES FOR USERS
     * *********************************************************************/
     function colours_meta_boxes( $meta_boxes ) {
    	$prefix = 'andydote_';
    	
    	// structure
    	$meta_boxes[] = array(
    		'title' => esc_html__('Brand Info', 'andydote-eshop-plugin'),
    		'type'  => 'user',
    		'fields' => array(
    			array(
    				'name' => esc_html__( 'Logo', 'andydote-eshop-plugin' ),
    				'id'   => $prefix . 'brand_image',
    				'type' => 'image_advanced',
    			),
    		),
    
    	);
    
        return $meta_boxes;
    }
    add_filter( 'rwmb_meta_boxes', 'colours_meta_boxes' );

    This is the code for adding the new field in "add new user" screen:

    // 1b.add new form elements in user new screen
    function andydote_user_new_form() {
        ?>
        
        <h2><?php esc_html_e( 'Brand Info', 'andydote-eshop-plugin' ); ?></h2>
        
    	<table class="form-table">
    
    		
    		<tr class="form-field">
    			<th scope="row"><label for="andydote_brand_image"><?php esc_html_e( 'Logo', 'andydote-eshop-plugin' ) ?> </label></th>
    			<td>
    				<img />' height='100'>
    				<input id="upload_brand_image_button" type="button" class="button" value="<?php esc_html_e( 'Add Media', 'andydote-eshop-plugin' ); ?>" />
    				<input type='hidden' name='andydote_brand_image' id='andydote_brand_image' value='<?php echo get_option( 'media_selector_attachment_id' ); ?>'>
    				<input type="submit" name="submit_image_selector" value="Save" class="button-primary">
    			</td>
    		</tr>
    		
    	</table>
    	
        <?php
    }
    add_action( 'user_new_form', 'andydote_user_new_form' );

    This is the code for saving the image field:

    // 3.save our extra registration user meta
    function andydote_user_register( $user_id ) {
        if ( isset( $_POST['submit_image_selector'] ) && isset( $_POST['andydote_brand_image'] ) ) {
    		update_user_meta( 'media_selector_attachment_id', absint( $_POST['andydote_brand_image'] ) );
    	}
    }
    add_action( 'user_register', 'andydote_user_register' );

    If you are interested, I use this reference: http://jeroensormani.com/how-to-include-the-wordpress-media-selector-in-your-plugin/

    Thank you!

    in reply to: Get a Select User Meta Value #5544
    socialitysociality
    Participant

    Alright,

    Thank you.

    in reply to: Get Image Attachment Meta #5338
    socialitysociality
    Participant

    It worked that too.

    Thanx!

    in reply to: Get Image Attachment Meta #5330
    socialitysociality
    Participant

    Ok, it worked!

    Thank you.

    I' ve got one more question. I have some select meta boxes and I want to get their name as soon as the user has selected an option and not their value.

    For example, for an option such as

    'past' => esc_html__( 'Past', 'colours-of-a-journey-plugin' ),

    I want to get the 'Past' name and not the 'past' value.

    The snippet

    $painting_time = rwmb_meta( 'colours_attachment_theme_tag', '', $painting['ID'] );

    gives me the value 'past'. How do I do that?

    Thank you in advance.

    in reply to: Multiple Selecet field values are not saved #5183
    socialitysociality
    Participant

    Yes,

    The strange thing is that it works for posts post type but not for the attachment post type. This is it:

    		$meta_boxes[] = array(
    		'title' => esc_html__( 'Artist Info', 'colours-of-a-journey-plugin' ),
    		'post_types'  => 'attachment',
    		'media_modal' => true,
    		'fields' => array(
    			array(
    				'name'		=> esc_html__( 'Theme tags (select one or more values)', 'colours-of-a-journey-plugin' ),
    				'id'		=> $prefix . 'attachment_theme_tags',
    				'type'		=> 'select',
    				'options'	=> array(
    					'past'		=> esc_html__( 'Past', 'colours-of-a-journey-plugin' ),
    					'present'	=> esc_html__( 'Present', 'colours-of-a-journey-plugin' ),
    					'future'	=> esc_html__( 'Future', 'colours-of-a-journey-plugin' ),
    					'home'		=> esc_html__( 'Home', 'colours-of-a-journey-plugin' ),
    					'nature'	=> esc_html__( 'Nature', 'colours-of-a-journey-plugin' ),
    					'passage'	=> esc_html__( 'Passage', 'colours-of-a-journey-plugin' ),
    					'peace'		=> esc_html__( 'Peace', 'colours-of-a-journey-plugin' ),
    				),
    				'multiple'			=> true,
    				'select_all_none'	=> true,
    			),
    		),
    	);
    
    in reply to: Get Image Attachment ID #5177
    socialitysociality
    Participant

    Ok thanx ๐Ÿ™‚

    socialitysociality
    Participant

    Meta box code:

    https://ghostbin.com/paste/28zgj

    make first and last name field required code

    https://ghostbin.com/paste/wd7hb

    in reply to: Define Metas for certain role (Contributor) #5139
    socialitysociality
    Participant

    Thank you for the guidance.

    It worked.

    in reply to: Metas for Attachment Post Type #5138
    socialitysociality
    Participant

    Alright,

    It worked. You can close the thread ๐Ÿ™‚

    in reply to: Metas for Attachment Post Type #5130
    socialitysociality
    Participant

    Hello,

    Thank you. I installed the development version and I got some errors such as

    Fatal error: Uncaught Error: Call to a member function get_source_lang_code() on null in /home/socia979/public_html/coloursofajourney.eu/cOlJ/wp-content/plugins/meta-box-master/inc/wpml.php:97 Stack trace: #0 /home/socia979/public_html/coloursofajourney.eu/cOlJ/wp-includes/class-wp-hook.php(298): RWMB_WPML->modify_field(Array) #1 /home/socia979/public_html/coloursofajourney.eu/cOlJ/wp-includes/plugin.php(203): WP_Hook->apply_filters(Array, Array) #2 /home/socia979/public_html/coloursofajourney.eu/cOlJ/wp-content/plugins/meta-box-master/inc/meta-box.php(320): apply_filters('rwmb_normalize_...', Array) #3 /home/socia979/public_html/coloursofajourney.eu/cOlJ/wp-content/plugins/meta-box-master/inc/meta-box.php(46): RW_Meta_Box::normalize_fields(Array) #4 /home/socia979/public_html/coloursofajourney.eu/cOlJ/wp-content/plugins/meta-box-master/inc/core.php(62): RW_Meta_Box->__construct(Array) #5 /home/socia979/public_html/coloursofajourney.eu/cOlJ/wp-includes/class-wp-hook.php(298): RWMB_Core->register_meta_boxes('') #6 /home/so in /home/socia979/public_html/coloursofajourney.eu/cOlJ/wp-content/plugins/meta-box-master/inc/wpml.php on line 97

    Are you sure I can use this version for a production environment?

    in reply to: Define Metas for certain role (Contributor) #5108
    socialitysociality
    Participant

    Hello,

    Didn't quite understand.

    1. Where should I put this code snippet? Inside the "fields" array?
    2. For the validation to work do I have to use the development version of the plugin or did you make an update for that?

    Thank you.

Viewing 15 posts - 1 through 15 (of 26 total)