Torg
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Create/Update a custom field when a post is publishedok, I have set my registration form to add a “user expire date” from 6 months after the registration date.
//Example to add 6 months to a date object $currentDate = date("Y-m-d");// current date //Add 6 months to current date $dateOneYearAdded = strtotime(date("Y-m-d", strtotime($currentDate)) . " +6 month"); echo date('Y-m-d', $dateOneYearAdded); $expiredate = date('Y-m-d', $dateOneYearAdded); ?> <input id="expire097" type="hidden" tabindex="30" size="25" value="<?php echo $expiredate; ?>" name="expire097" /> <?php } function check_fields ( $login, $email, $errors ) { global $expire097; if ( $_POST['expire097'] != $expiredate ) { $errors->add( 'empty_realname', "<strong>ERROR</strong>: Please don't hack website" ); } else { $expire097 = $_POST['expire097']; } } function register_extra_fields ( $user_id, $password = "", $meta = array() ) { update_user_meta( $user_id, 'expire097', $_POST['expire097'] ); } ?>
to eliminate the problem of a possible hacking with firebug (in case someone changes the property “hidden”), I added a control:
If the value of the field is different from the date of +6 months now returns an error “Please do not hack website”.Unfortunately I do not know why it always returns the error even if the value in the field is identical to the printed value (with echo)
Sorry, I am not an expert in php and I could have made a mess.
let me know
SeeYaForum: Fixing WordPress
In reply to: Retrieving post list of this author metamany thanks vtxyzzy, you’re the man!
Forum: Fixing WordPress
In reply to: Retrieving post list of this author metaThank’s a lot vtxyzzy !
now I’ve done this:
List maximum of 5 posts in category 35 or 42, sorted by “event_start_date”, ASC, and only if “event_start_date” is equal or higher than current date<?php global $wpdb; global $post; $querystr = " SELECT wposts.* FROM $wpdb->posts wposts LEFT JOIN $wpdb->postmeta wpostmeta ON wposts.ID = wpostmeta.post_id LEFT JOIN $wpdb->term_relationships ON (wposts.ID = $wpdb->term_relationships.object_id) LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) WHERE wpostmeta.meta_key = 'event_start_date' AND wpostmeta.meta_value >= CURDATE() AND $wpdb->term_taxonomy.taxonomy = 'category' AND $wpdb->term_taxonomy.term_id IN(35,42) ORDER BY wpostmeta.meta_value ASC LIMIT 5 ";
this work well!
but now I want to add another condition like:
only if an author_meta called “subscription_expire” is equal or higher than current datebut I’ve not find enough examples for my limited knowledge of php,
I think it should be something like:WHERE author_meta.meta_key = 'subscription_expire' AND author_meta.meta_value >= CURDATE()
is author_meta.meta_value and author_meta.meta_valueright?
where i can put the code? after the last “AND”?thank’s for your attention
Forum: Fixing WordPress
In reply to: Create/Update a custom field when a post is publishedit’s a Type, like “text field” “text area” “checkbox” and “list”
Type = Hidden Field
Default Value = Yesbut if the data is confidential (in my case would be the day on which the post expire and the user should be not able to change it)
Note that if the visitor has Firebug (or similar) can eliminate the type “hidden field” and he can change the default value!!!Forum: Fixing WordPress
In reply to: Create/Update a custom field when a post is publishedI’m interested, did you have try with a hidden custom field with default value in TDO form creator?
exist an option “Treat default value as code (php)” but I have not try it.let me know
Forum: Plugins
In reply to: [Plugin: TDO Mini Forms] Let the user edit only his postI do not think the problem seems to be the plugin TDO Mini …
I have not been resolved even with the various plugins premium
keep in touch
see ya