supernova42
Forum Replies Created
-
Forum: Plugins
In reply to: [Participants Database] Max Image upload for different usersI 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
Forum: Plugins
In reply to: [Participants Database] Image Categories based on Users NameThis 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);
Forum: Plugins
In reply to: [Enhanced Media Library] Programmatically add images to categoryI’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);Forum: Plugins
In reply to: [Participants Database] pdb_single field orderfunction 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
)
);
}Forum: Plugins
In reply to: [Participants Database] Image Categories based on Users NameI’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.Forum: Plugins
In reply to: [Participants Database] Suppressing empty fieldsBlast!!!
I’ve just discovered
.pdb-single .blank-field {
display: none;
}Worked great….
Forum: Plugins
In reply to: [Participants Database] See all images with a single photo displayI think there is great merit in looking at the questions other members ask and the solution you give.
Forum: Plugins
In reply to: [Participants Database] Suppressing empty fieldsHi 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
Forum: Plugins
In reply to: [Participants Database] I’ve found a small problem.This is working now Roland. I guess you fixed it in one of your recent updates.
Thanks
Forum: Plugins
In reply to: [Participants Database] Formatting Decimal NumbersI changed it in the database
Forum: Plugins
In reply to: [Participants Database] Drop Down MenuI’ve abandoned that. It’s too unreliable…
Forum: Plugins
In reply to: [Participants Database] Location of template filesOkay I’ve reinstated them now
Thank you
Forum: Plugins
In reply to: [Participants Database] Problems with multiple fields being displayedI’ve gone back to providing just 1 sale item for each member which overcomes the problem I’ve highlighted.
Thanks for help
Forum: Plugins
In reply to: [Participants Database] I’ve found a small problem.It’s in thie pdb_list template=multisearch shortcode
Forum: Plugins
In reply to: [Participants Database] Currency SymbolI just could not find that in the documentation.
Many Thanks