Harsh Goyal
Forum Replies Created
-
Hi @prashantrai
This Also doesn’t help. it does reduce the size of the captcha box(like it cuts of the part and show sonly 90%) but it is not responsive. it doesnt look good and we can clearly see that thr is something missing
Hi Team,
Thank you it look’s good now. Thank you.
Thanks and regards
hi @prashantrai
sorry for late rely,But no it does not help. (no cache plugin is present, i cleared from hosting side)
Thanks and Regards
hi @prashantrai,
thank you for working on this, but sadly this doesn’t help :(.
Hopefully for the best ??
Thanks and Regards
Harshhi @prashantrai
The browser that i am using is chrome and the device i am using is vivo v9 pro.
https://drive.google.com/file/d/18W2ZKPjz3_vlHbTyZtWxeTdUyT8PKZVg/view?usp=sharing
hope this helps ??
Thanks and regards
hi @champsupertramp any update on this?
hi @champsupertramp,
nope it redirects to logged in user profile.
example:
if its me, i can visit 4 profile and 5th will redirect to my profile it self.
Regards,
here is the code
add_action("init", function(){ um_013122_install_db(); }); function um_013122_install_db() { global $wpdb; // Let's not break the site with exception messages //$wpdb->hide_errors(); if ( ! function_exists( 'dbDelta' ) ) { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; } $collate = ''; if ( $wpdb->has_cap( 'collation' ) ) { $collate = $wpdb->get_charset_collate(); } $schema = " CREATE TABLE {$wpdb->prefix}custom_visited_profiles ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, user_id integer, visited_user_id integer, visited_date datetime, primary key (id) ) $collate;"; dbDelta( $schema ); } add_action("template_redirect","um_custom_visit_profile", 99999 ); function um_custom_visit_profile(){ if( ! class_exists("UM") ) return; if( ! um_is_myprofile() && um_is_core_page("user") ){ global $wpdb; $visiting_user_id = um_get_requested_user(); $user_id = get_current_user_id(); // GET USER ORDERS (COMPLETED + PROCESSING) $customer_orders = get_posts( array( 'numberposts' => -1, 'meta_key' => '_customer_user', 'meta_value' => $user_id, 'post_type' => wc_get_order_types(), 'post_status' => array_keys( wc_get_is_paid_statuses() ), ) ); if ( ! $customer_orders ) return; // Get all user's purchased products and sum all the limit $limit = 0; foreach ( $customer_orders as $customer_order ) { $order = wc_get_order( $customer_order->ID ); $items = $order->get_items(); foreach ( $items as $item ) { $product_id = $item->get_product_id(); $p = new WC_Product( $product_id ); // create an object of WC_Product class $limit += (int)$p->get_attribute( 'um_view_profile_limit' ); // call get_attribute method } } update_user_meta( $user_id, "um_view_profile_limit", $limit ); $has_row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}custom_visited_profiles WHERE user_id = %d AND visited_user_id = %d", $user_id, $visiting_user_id ) ); $total_visited = (int) get_user_meta( $user_id, "um_total_visited_profiles", true ); $total_limit = (int) $limit; if( $total_visited >= $total_limit ){ // If the user rechead the viewing limit, redirect them to a custom page wp_redirect("/reached-limit"); exit; } if( ! $has_row ){ // if user hasn't visited this profile, add the viewing profile in the currently logged-in user's record $table = $wpdb->prefix.'custom_visited_profiles'; $data = array('user_id' => $user_id, 'visited_user_id' => $visiting_user_id ); $wpdb->insert( $table, $data ); $results = $wpdb->get_results( $wpdb->prepare("SELECT * FROM {$wpdb->prefix}custom_visited_profiles WHERE user_id = %d ", $user_id ) ); update_user_meta( $user_id, "um_total_visited_profiles", count( $results ) ); } } }
hi @champsupertramp,
yes this looks good, now the numbers also updating perfectly. table is also created in the database i manually verified. now the thing is i am not able to check/ open all the profiles. for gold membership i gave 20 as limit, but the i am able visit only 4 profiles ?? hoping we can solve this and get this over with.
Hard luck. still facing the issue and the table is still nor created ??
Thanks and regards
Harshnope i could not find the table in myphpadmin database. yep i had already disabled the UM user cache.
table not being present could be the root of this problem
i have tried the above. i am able to see the profile limit in the profile page. i created a new form and registered and bought a plan. so now the maximum view is updating properly but the views left, is not updating. plus the old issue still remains, not able to see more than 2-3 profiles. i did check my myphpadmin and could not find the table only (custom_visited_profiles). not sure what that is all about.
hoping for the best ??
thanks and regards,
Harsh Goyalhi @champsupertramp,
nope the issue still persists.
wocom attribute which i created is
um_view_profile_limit – order by(custom ordering) – config items(10,20)
i have also tried – order by(Name Numeric)copied the same code as above and placed it in the function.php of the child theme
create table command is also placed in the same function.phpcreated a “reach-limit” page as well.
hope you will be able to crack it
also,
i wanted to know is thr a place we can view how many profiles have been viewed and how many they have left(this can be useful for both the admin and user )i have done all the mentioned above,
there is a issue, i am not sure why it is happening.for now i have given gold -11 view and silver – 10 views attribute as u mentioned of type(name (numeric)).
i am only able to view gold – 5 views and silver 4 views. plus every time i try to see other profile after this, it diverts back to the active user profile. i have tried increasing the view count but the same result.
i have made a reached-limit page as well. i have 150+ sample users set for testing.
could you please check it out.
used this code for creating table
function function_to_install_db() { global $wpdb; // Let's not break the site with exception messages $wpdb->hide_errors(); if ( ! function_exists( 'dbDelta' ) ) { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; } $collate = ''; if ( $wpdb->has_cap( 'collation' ) ) { $collate = $wpdb->get_charset_collate(); } $schema = " CREATE TABLE {$wpdb->prefix}wp_custom_visited_profiles ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, user_id integer, visited_user_id integer visited_date datetime ) $collate;"; dbDelta( $schema ); }
- This reply was modified 3 years, 1 month ago by Harsh Goyal.
- This reply was modified 3 years, 1 month ago by Harsh Goyal.