BuddyDev

Search

Replies

  • Participant
    Level: Initiated
    Posts: 16
    Nushara on #36339

    Hey Brajesh,

    I don’t think my programming skills are well enough to get this production ready, so I would pass on that.

    But I could come up with something after you have added the initial feature and expand it by what I would use it for. So you could maybe work on top of that and release it for everyone to enjoy.

    Thanks for your hard work and feel free to get in touch for any ideas or details about this or other projects. xProfile really is a life safer for me, so I would be happy to help making it even greater.

  • Participant
    Level: Initiated
    Posts: 16
    Nushara on #36217

    Hey Brajesh,

    that’s a shame since I think a lot of people would really benefit from it. It would really come in handy to have like a max dimensions setting in the admin panel to limit file size and dimensions as an optional setting. Kinda like the “Birthdate Selector” is having some settings.

    It would also save some space since you could change its quality for JPEGs for example.

    But I can understand you wanting to keep it simple.
    To me this would be a great addition and I would do it on my own, but I don’t want to add too much changes to your code to stay update ready.

    How does the up voting exactly work?

  • Participant
    Level: Initiated
    Posts: 16
    Nushara on #36204

    Hey Brajesh,

    thank you for the quick reply.

    Would it be possible to resize the image with the new filter validation? Or is it only displaying like “your image dimensions are too big, please use a smaller image”?

    Since most users are pretty lazy, and I think it would make sense to just resize bigger images instead of rejecting them.

    Would be great to have it like an option or something if it should resize bigger images or throw an error.

    Thanks for your work! It is very much appreciated.

  • Participant
    Level: Initiated
    Posts: 16
    Nushara on #28814

    Hey @Brajesh Singh

    I just wanted to get back to you if you have news about this topic?

  • Participant
    Level: Initiated
    Posts: 16
    Nushara on #28581

    Hey Brajesh,

    thank you for the reply. I already fiddled around with it, but I am not getting it to work. The biggest issue I am facing is to append the content instead of replacing it. Also, how to fire the function and wait for it to finish till it can get fired again (since you are already scrolled at the bottom so it fires more than once).

    So instead of hacking it together creating more issues I will have to wait for you to post an example.

    Let me know if I can help you out at any point. Maybe we can make it work together.

    Best regards,
    – Mike from Nushara

  • Participant
    Level: Initiated
    Posts: 16
    Nushara on #28455

    Thank you very much, you were giving me to the right direction.

    What I came out with is:

    
    bp_filter_request('members', '<?= $var ?>', 'all', '#members-dir-list', '', 1, '', '', '');
    

    Which is working fine.

    You have a great day,

    – Mike from Nushara

  • Participant
    Level: Initiated
    Posts: 16
    Nushara on #28442

    So what I have found out so far is it would be something like this:

    
    									$.ajax({
    										type: "post",
    										dataType: "json",
    										url: "/wp-admin/admin-ajax.php",
    										data: { 
    											cookie: 'bp-members-filter%3D<?= $var ?>%26bp-members-scope%3Dall',
    											action: 'members_filter',
    											object: 'members',
    											filter: '<?= $var ?>',
    											user_id: user_id,
    											scope: 'all',
    											page: '1',
    											search_terms: '',
    											template: '',
    											exclude: false},
    										success: function(data) {
    											
    										}
    									});
    

    But it is of course not working. I just thought it would be helpful to make it easier.

  • Participant
    Level: Initiated
    Posts: 16
    Nushara on #28179

    Oh ok, I thought this would be the right place to post something like this.

    I am sorry then. I changed the postmeta to usermeta and updated the code to work pretty well for me.

    This way you always relate to a users ID like all the other user related stuff.

    But thank you for assisting me till this point.

    You have a great day!

    Regards,
    Mike from Nushara

  • Participant
    Level: Initiated
    Posts: 16
    Nushara on #28161

    Oh and they are stored on the postmeta, not usermeta.

  • Participant
    Level: Initiated
    Posts: 16
    Nushara on #28160

    I have done some changes to this, you are right there is a lot of wrong with this.

    But even after changing this, it is still not working for these users.

    
    	/**
    	 * # Set Profile Views Number .
    	 */
    	function set_profile_views( $profile_ID ) {
    
    	 	// The user's IP address
    	    $user_ip = $_SERVER['REMOTE_ADDR'];
    	    $ip_key = 'profile_views_ip'; // The IP Address post meta key
    	    $views_key = 'profile_views_count'; // The views post meta key
    
    	    // The current post views count
    		$count = get_post_meta( $profile_ID, $views_key, true );
    		
    		//Check day
    		$day = date("l");
    		$day_table = 'profile_views_day'; // Set the day to check
    		$setDay = get_post_meta( $profile_ID, $day_table , true );
    		$checkDay = metadata_exists('post', $profile_ID, 'profile_views_day');
    
    		//Check if Viewcount and IP Table already exist
    		$check_ip = metadata_exists('post', $profile_ID, 'profile_views_ip');
    		$check_views = metadata_exists('post', $profile_ID, 'profile_views_count');
    
    		//Bank IT-Tables
    		$blank_array = array();
    		$json_array = json_encode( $blank_array );
    
    		if ( is_page() ) {
    			//Check if Views already exist
    			if(!$check_views){
    				add_post_meta( $profile_ID, $views_key, 0 );
    			}
    
    			//Check if IP-Meta already exist
    			if(!$check_ip){
    				add_post_meta( $profile_ID, $ip_key, $json_array );
    			}
    
    			if(!$checkDay){ //Check if day is set in database
    				add_post_meta( $profile_ID, $day_table , $day );
    			}else{
    				if($day != $setDay){ // Check if day is the same as database
    					update_post_meta( $profile_ID, $day_table , $day );
    					update_post_meta( $profile_ID, $ip_key, $json_array);
    				}
    			}
    
    			// Array of IP addresses that have already visited the post.
    			if ( '' != get_post_meta( $profile_ID, $ip_key, true ) ) {
    			    $ip = json_decode( get_post_meta( $profile_ID, $ip_key, true ), true );
    			} else {
    				$ip = array();
    			}
    
    			// The following checks if the user's IP already exists
    			for ( $i = 0; $i < count( $ip ); $i++ ) {
    			    if ( $ip[ $i ] == $user_ip ) {
    			        return false;
    			    }
    			}
    
    			// Update and encode the $ip array into a JSON string
    			$ip[ count( $ip ) ] = $user_ip;
    			$json_ip = json_encode( $ip );
    
    			// Update the post's metadata
    			$count++;
    			update_post_meta( $profile_ID, $views_key, $count ); // Update the count
    			update_post_meta( $profile_ID, $ip_key, $json_ip ); // Update the user IP JSON obect
    		}
    	}