Forum Replies Created

Viewing 15 replies - 31 through 45 (of 191 total)
  • Thread Starter supernova42

    (@supernova42)

    I can’t see how to use this filter Roland. I’ve used it in my shortcode but with no effect. I’ve also created a field in my database called ‘maximum_files’.

    <?php

    $maximum_files=’7′;

    echo do_shortcode(‘[pdb_record filter=pdb-{$maximum_files}_maxfiles fields=”photo_library” record_id=’.$user_id.’]’);

    Thanks

    Thread Starter supernova42

    (@supernova42)

    This is an improvement on my last attempt.
    I use the plugin ‘Enhanced Media Library’ as I can view each of the categories individually.

    This routine creates a separate category for each user, or it could be product or item etc. This routine just needs to be run once for each user, probably at joining.

    The next stage is to allocate each image to the defined category for that user which will give a totally organised media library (sort of…).

    I’m hoping Roland will give me a few pointers for this next stage.

    Thanks

    $current_user    = wp_get_current_user();
    $wp_username     = $current_user->user_login;
    $user_id         = Participants_Db::get_record_id_by_term('username', $wp_username);
    $data            = Participants_Db::get_participant($user_id);
    $first_name      = $data['first_name'];
    $last_name       = $data['last_name'];
    $boat_name       = $data['boat_name'];
    $boat_model      = $data['boat_model'];
    $parent_name     = 'Members Boats';
    $my_category     = $boat_name.' ['.$user_id.']';
    $my_description  = $first_name.' '.$last_name.' ['.$boat_model.']';
    
    function insert_category ($category,$description,$parent) {
    $parent_term = term_exists($parent,'media_category');
    $parent_term_id = $parent_term['term_id'];
    wp_insert_term(
        $category,
        'media_category',
        array(
            'description' => $description,
            'slug'        => $category,
            'parent'      => $parent_term_id,
        )
    );
    }
    
    insert_category($my_category,$my_description,$parent_name);

    I’m working on this too

    I’ve written the code to create media categories which could be based on users name as it would need to be unique.

    This is what I’m playing around with so far.

    For some reason I cannot get the parent to work as I can’t find what variable was used.

    I now need to assign my uploaded images to specific categories. I could put a routine inside so that it runs at log in to create the users category and assign all their images to that category.

    Has anyone else got anywhere with this?

    Let me know….

    function insert_category($category,$description,$parent) {
    wp_insert_term(
    $category,
    ‘media_category’,
    array(
    ‘description’ => $description,
    ‘parent’ => $parent,
    ‘slug’ => $category //convert to lower case with hyphen
    )
    );
    }
    add_action(‘after_setup_theme’,’insert_category’);

    $first_name =’John’;
    $last_name =’Thomas’;
    $user_id =’1021′;
    $username =’thom_j’;
    $parent_name =’Members Boats’;
    $usercode = $first_name.’ ‘.$last_name.’ [‘.$user_id.’]’;
    insert_category($username,$usercode,$parent_name);

    Thread Starter supernova42

    (@supernova42)

    function insert_category($category,$description,$parent) {
    wp_insert_term(
    $category,
    ‘media_category’,
    array(
    ‘description’ => $description,
    ‘media_parent’ => $parent,
    ‘slug’ => $category //convert to lower case with hyphen
    )
    );
    }

    Thread Starter supernova42

    (@supernova42)

    I’ve finally managed to work out what I need to do to create a category for each user as shown below.

    function insert_category($category,$description,$parent) {
    wp_insert_term(
    $category,
    ‘media_category’,
    array(
    ‘description’ => $description,
    ‘media_parent’ => $parent,
    ‘slug’ => $category //convert to lower case with hyphen
    ));}
    add_action(‘after_setup_theme’,’insert_category’);

    I can create this category when the user first joins the site. $category will be the users wordpress username. I might have to use something like cat_username to differentiate it from the actual username.

    The only thing that remains is – How do I assign a category name (i.e. UserName) to each photo as it is uploaded. Once I’ve done that my media library is totally organised. Do you think you could help me out?

    Thanks

    ps
    This would be a great feature to add to the multi image add-on.

    Thread Starter supernova42

    (@supernova42)

    Blast!!!

    I’ve just discovered

    .pdb-single .blank-field {
    display: none;
    }

    Worked great….

    Thread Starter supernova42

    (@supernova42)

    I think there is great merit in looking at the questions other members ask and the solution you give.

    Thread Starter supernova42

    (@supernova42)

    Hi Roland

    I did think that you might have pulled something out of your hat to suppress the display of the empty fields.

    I have now supressed the fields using the following. This is just part of the code as I have many fields, but it gives an idea of how it can be done. However, it’s possible that there might be an easier way.

    $id= $_GET[‘pdb’];
    $data = Participants_Db::get_participant($id);
    $name = $data[‘name’];
    $price = $data[‘price’];
    $model = $data[‘model’];

    if (empty($name)) {echo ‘<style>dt.name{display:none}</style>’;}
    if (empty($price)) {echo ‘<style>dt.price{display:none}</style>’;}
    if (empty($model)) {echo ‘<style>dt.model{display:none}</style>’;}

    Many Thanks

    Thread Starter supernova42

    (@supernova42)

    This is working now Roland. I guess you fixed it in one of your recent updates.

    Thanks

    Thread Starter supernova42

    (@supernova42)

    I changed it in the database

    Thread Starter supernova42

    (@supernova42)

    I’ve abandoned that. It’s too unreliable…

    Thread Starter supernova42

    (@supernova42)

    Okay I’ve reinstated them now

    Thank you

    Thread Starter supernova42

    (@supernova42)

    I’ve gone back to providing just 1 sale item for each member which overcomes the problem I’ve highlighted.

    Thanks for help

    Thread Starter supernova42

    (@supernova42)

    It’s in thie pdb_list template=multisearch shortcode

    Thread Starter supernova42

    (@supernova42)

    I just could not find that in the documentation.

    Many Thanks

Viewing 15 replies - 31 through 45 (of 191 total)