Last active
February 25, 2025 21:09
-
-
Save yuriinalivaiko/b1dc305b1a821853663c408ddd8eed9a to your computer and use it in GitHub Desktop.
Code snippets for the "Social Activity" extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Use direct links for images in the social activity wall. | |
function um_activity_get_download_link_direct( $url, $post_id, $author_id ) { | |
$photo = get_post_meta( $post_id, '_photo', true ); | |
return home_url( "/wp-content/uploads/ultimatemember/{$author_id}/{$photo}" ); | |
} | |
add_filter( 'um_activity_get_download_link', 'um_activity_get_download_link_direct', 10, 3 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Use plain links for images in the social activity wall. | |
add_action( 'wp_ajax_um_activity_publish', 'um_activity_load_wall_permalinks', 9 ); | |
add_action( 'wp_ajax_um_activity_load_wall', 'um_activity_load_wall_permalinks', 9 ); | |
add_action( 'wp_ajax_nopriv_um_activity_load_wall', 'um_activity_load_wall_permalinks', 9 ); | |
function um_activity_load_wall_permalinks() { | |
UM()->is_permalinks = false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Images in the activity posts may work wrong if rewrite rules on your website are misconfigured or if your server firewall blocks image URLs.
Go to wp-admin > Settings > Permalinks. Don’t change settings on this page, just update. WordPress will update rewrite rules on your website.
Follow recommendations in this article if you use the Nginx web server: NGINX Configuration Rewrite Rule for Ultimate Member Social Activity. Verify settings for the ModSecurity (WAF) module if this module is installed on the server. Make sure that these URLs are allowed:
URL structure:
http://{domain}/um-activity-download/{post_id}/{author_id}/{verify_key}/{image}
Example:
http://um.loc/um-activity-download/2906/29/65933a9946/1709136141.jpg
As a temporary solution you can use a code snippet to change the URL structure for images. Select the solution that best suits you:
You can add code snippet to the functions.php file in the theme directory or using a special plugin like Code Snippets or WPCode.