igogra
Forum Replies Created
-
I solved it.
I just changed the code in my registration page from:
do_action('user_register', $username, $email, $user_id);
to:
do_action('register_post', $username, $email, $error);
Your plugin works fine. Thanks for this great plugin.
I tried with the following code from the registration page in the Front-End:
... $user_id = wp_insert_user( array ('user_pass' => apply_filters('pre_user_user_pass', $pwd1), 'user_login' => apply_filters('pre_user_user_login', $username), 'user_email' => apply_filters('pre_user_user_email', $email), 'role' => 'subscriber' ) ); do_action('user_register', $username, $email, $user_id); ...
The request_admin_approval_email function inside the plugin still misses the second and third arguments ($user_email and $errors).
I found a solution.
The problem was that the new title and content weren’t saved. So I did the following change.
In the plugin’s folder, in the Postdrafter.php file inside the create_draft function, after this line:
$post_data = array_intersect_key((array) $parent, $fields);
I added the following code:
$post_data['post_title'] = wp_strip_all_tags( $_POST['post_title'] ); $post_data['post_content'] = $_POST['post_content']; $post_data['post_excerpt'] = $_POST['post_excerpt'];
Forum: Plugins
In reply to: [Magic Fields 2] Conditional related typeI just solved it.
I modified the plugin. In the plugin’s folder I duplicated the related_type_field folder. I renamed it as related_author_type_field (the folder and the php file). And then in related_author_type_field.php I added an ‘if’ statement to check if the current user is the author inside the display_field function:
public function display_field( $field, $group_index = 1, $field_index = 1 ) { ... foreach($options as $option) { if($option->post_author == get_current_user_id()) { // Added ... // Here everything that was inside the foreach } } ... }
Forum: Plugins
In reply to: [Plugin: WP_pagenavi] not working in index.phpI just solved it.
I added the following code in functions.php:
function news_index($query) { if (!is_admin() && $query->is_main_query() ) { if ($query->is_home()) { $query->set('post_type', 'news'); $query->set('cat', -5); } } } add_action('pre_get_posts', 'news_index');
And in index.php I removed the custom query:
... <?php if ($have_posts()) : ?> <ul> <?php while (have_posts()) : the_post(); $do_not_duplicate = $post->ID; ?> <li> // Code for displaying news </li> <?php endwhile; ?> </ul> <?php endif;?> <?php if(function_exists('wp_pagenavi')) : ?> <div class="navi"><?php wp_pagenavi(); ?></div> <?php endif; ?> ...
Forum: Plugins
In reply to: Ordered previous_post_link & next_post_link by custom fielddown vote accept
Finally I solved it!
I just used the plugin Next/Previous Post Link Plus for WordPress and added the following code in my single page of products (single-products.php):
<?php next_post_link_plus( array( 'order_by' => 'custom', 'meta_key' => 'data_product_name_product', 'link' => 'Next product', 'format' => '%link' )); ?> <?php previous_post_link_plus( array( 'order_by' => 'custom', 'meta_key' => 'data_product_name_product', 'link' => 'Previous product', 'format' => '%link' )); ?>
Forum: Hacks
In reply to: Custom Ordering Post Link FunctionsAny help?