Support has been upgraded!
The Support Forum is closed. Not to worry! Providing the top quality support you expect and we're known for will continue! We're not ending support, just changing where you submit requests. This will provide you with the best experience possible.
Premium Support
Have you purchased an addon for Connections such as one of our premium templates or extensions with a valid license and you need help?
Please open a Support Ticket in your user account.
Free Support
Are you using the free Connections plugin? Don't worry, you are still very important to us! We are still providing you with the same high quality support that we're known for.
Please open a new support topic in the WordPress support forums for Connections.
Tagged: 8.1.5, cn_address, filter
- This topic has 3 replies, 3 voices, and was last updated 8 years, 4 months ago by
Steven Zahm.
-
AuthorPosts
-
01/06/2015 at 12:04 am #314089
Jason Higgins
ParticipantI would like to make the “City” and “State” fields public, but the actual street address private. Is this possible? I do know php, so if you can point me in the right direction I might be able to figure it out.
01/06/2015 at 9:48 am #314102Steven Zahm
Keymaster@ Jason
Sorry, there is nothing built in to do this and likely something that will not be added, it is too niche of a feature, sorry.
One possibility you can investigate …
You could hook into the
cn_address
filter. And remove or leave the street address based on the current logged in user’s capabilities.This is not tested or even working code but will point you in the direction:
add_filter( 'cn_address', 'cn_private_street_address' ); function cn_private_street_address( $address ) { if ( ! current_user_can('manage_options') ) { unset( $address->line_1 ); unset( $address->line_2 ); unset( $address->line_3 ); } }
What this should do, is if a user can not manage_options which is a default capability for the Admin role only in WordPress:
http://codex.wordpress.org/Roles_and_CapabilitiesBasically this should make the address visible to only admins.
The only possible gotcha is that you might lose the street address is a user with a role that is not an admin edits an entry.
Hope that helps!
If you have a moment, I would truly appreciate a review as they really do make a difference. Many thanks in advance!
https://wordpress.org/support/view/plugin-reviews/connections01/15/2015 at 10:09 am #314949Jason
GuestThanks for the response Steven. I didn’t use your approach, but it did lead me in the right direction. Instead, I’ve just edited the card.php file and added is_user_logged_in() condition on any fields I wanted to FORCE to be private. For example, we always want phone numbers to be private, and sometimes forget to check the radio box for private. So I changed this:
if ( $atts['show_phone_numbers'] )
To be this:
if ( $atts['show_phone_numbers'] && is_user_logged_in() )
That seemed to do the trick!
01/15/2015 at 10:57 am #314959Steven Zahm
Keymaster@ Jason
Yep, that’ll work too. Glad to hear you found a solution that works for you.
If you have a moment, I would truly appreciate a review as they really do make a difference. Many thanks in advance!
https://wordpress.org/support/view/plugin-reviews/connections -
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.