Forum Replies Created
-
AuthorPosts
-
Steven Zahm
Keymaster@ Bert
re: When a user logs in he/she can only add a new entry and not change his/her own entry.
This because the incorrect option was selected when configuring Link. The second screenshot shows the correct option to enable. I made the change.
Also both the Edit Entry and Edit Entry Moderated role capability was selected. It should be either or, not both. I removed the Edit Entry capability.
re: Is the ‘user’ column in the CONNECTIONS table the only link necessary for the link between a user and a cn-entry ?
No, there is also data added to the usermeta.
Looking at the kristof entry and user… it appears that the usermeta is missing… or perhaps manually added to the Connections table?
The only way to fix that user is to delete the user and the entry so the link is completely broken. When the ewn entry is added, the email for the user and the entry must be identical. Currently the user email and the entry email do not match. That is fine as long as the entries are linked initially.
I believe with the config changes I made to the role and the action link the issue will be resolved. I hope that helps.
Steven Zahm
Keymaster@ Jonathan
First, adding this field does not require editing the core Connections code, I strongly recommend that you do not do that so you can safely apply updates to Connection as they are released.
The following code adds an upload field which will upload a file into the WordPress Media Library and save the file meta into the entry meta. This pretty basic code and does not do stuff such as removing an existing file from the Media Library if the user uploads a new file, does not remove the file if the entry is deleted, does not limit file types and so on. You’ll need to add the code to take care of those actions and tighten up security.
As you see it is actually pretty simple. Once you know how, of course. More than half the code is the usual code one would use to upload files in WordPress. The remaining code registers the custom field and custom meta box to display the field, the file meta if a file is uploaded to the entry. Really the only Connections specific code is the action hooks needed, the code within the action callbacks is nothing special, and the callback function which actually registers the custom field and metabox.
// Register the custom upload field. add_action( 'cn_meta_field-resume_upload_field', 'resume_upload_field', 10, 3 ); // Register the metabox and field. add_action( 'cn_metabox', 'resume_upload_metabox' ); // Since we're using a custom field, we need to add our own sanitization method. add_filter( 'cn_meta_sanitize_field-resume_upload_field', 'sanitize_resume_upload_field' ); // Render the custom upload field. function resume_upload_field( $field, $files, $entry ) { resume_upload_file_meta( $files ); echo '<p><input type="file" name="resume" id="resume" /></p>'; } // Display the uploaded file meta. function resume_upload_file_meta( $files ) { if ( ! empty( $files ) && is_array( $files ) ) { foreach ( $files as $file ) { echo '<p><strong>Name:</strong> <input class="large-text" type="text" value="' . esc_attr( $file['name'] ) . '" disabled></p>'; echo '<p><strong>Path:</strong> <input class="large-text" type="text" value="' . esc_attr( $file['file'] ) . '" disabled></p>'; echo '<p><strong>URL:</strong> <input class="large-text" type="text" value="' . esc_attr( $file['url'] ) . '" disabled></p>'; } } } // Render the metabox which will reder the custom upload field. function resume_upload_metabox() { $atts = array( 'id' => 'resume-metabox', 'title' => 'Resume', 'context' => 'normal', 'priority' => 'core', 'fields' => array( array( 'id' => 'resume', 'type' => 'resume_upload_field', ), ), ); cnMetaboxAPI::add( $atts ); } // This will pass back an array of the file meta data such as filename, path and URL which // will be saved into the entry meta. function sanitize_resume_upload_field( $file_meta ) { $file_meta = array(); if ( ! empty( $_FILES ) ) { foreach( $_FILES as $file ) { if ( is_array( $file ) ) { $result = upload_resume( $file ); if ( false != $result ) { $file_meta[] = $result; } } } } return $file_meta; } // Process the uploaded file. function upload_resume( $data ) { if ( ! function_exists( 'wp_handle_upload' ) ) { require_once( ABSPATH . 'wp-admin/includes/admin.php' ); } $upload = wp_handle_upload( $data, array( 'test_form' => false ) ); if ( isset( $upload['error'] ) || isset( $upload['upload_error_handler'] ) ) { return false; } else { $upload['name'] = basename( $upload['file'] ); $attachment = array( 'post_mime_type' => $upload['type'], 'post_title' => preg_replace( '/\.[^.]+$/', '', $upload['name'] ), 'post_content' => '', 'post_status' => 'inherit', 'guid' => $upload['url'] ); wp_insert_attachment( $attachment, $upload['url'] ); return $upload; } return false; }To have this field show up in Form, go to the Connections : Settings admin page, click the Form and enable the Resume field, drag it in the position you want it and click the save button.
Hope that helps!
Steven Zahm
Keymaster@ Sarah
I used the login from your other ticket to look at this and I see all 13 entries on the Manage page. So everything seems fine with Connections. So I installed User Switching so I could view the page as if I were you and I could not see the entries. My best guess is that your user meta for Connections became corrupt somehow. By simply clicking the filter button, leave the default options selected, reset the user meta and new you can view the entries.
Hope that helps!
ps. I left User Switching installed. You can safely uninstall it if you wish. I find it an invaluable tool and highly recommend it.
Steven Zahm
Keymaster@ Sarah
I added your theme to the exclusion list and that fixed it. Looks like I’ll have to come up with a different method to prevent duplicate entry content when the
[connections]shortcode is used on the same page more than once. Keeping an exclusion list just is not going to be scalable or maintainable.Hope this helps!
Steven Zahm
Keymaster@ Sarah
I’ll need a temp admin login so I can take a closer look. The login details can be posted here as a private reply.
Steven Zahm
Keymaster@ John
Navigate to the Connections : Settings admin page and click the Licenses tab. Make sure you have entered in the support license keys and activated them. After y9ou do you should be able to update without issue.
Hope this helps, let me know.
Steven Zahm
Keymaster@ Andrew
Sorry, to hear you are having trouble. To assist I’ll need a few more details.
- Which Wp version do you have installed?
- Which version of Connections is installed?
- Which version of Link do you have installed?
- Can you confirm that the Link extension is activated?
- Do you have any membership type plugins installed? If so, which one?
- Do you have any frontend login or login redirect type of plugins installed? If so, which ones?
- How have you confirmed that users are not being linked? Can you give me the step by step process of our testing?
Steven Zahm
Keymaster@ Jonathan
I’ll see I can toss together some code examples tomorrow.
Steven Zahm
Keymaster@ keith
Add
show_email=trueto the[connections]shortcode so you have something lie this[connections show_email=true].Hope that helps!
Steven Zahm
Keymaster@ Marty
My best guess is that you have installed and activated the Contact extension. When this extension is activated, it hides all email addresses, making them private, so visitors only contact the entries using the contact form.
Hope that helps, let me know.
-
AuthorPosts
