patriqueuiliam
Forum Replies Created
-
Forum: Plugins
In reply to: [BuddyPress Simple Events] How to generate random slugsI managed to solve
‘
function change_events_slug( $slug, $post_ID, $post_status, $post_type ) {
if ( 'event' === $post_type ) {
$slug = substr( md5( rand() ), 0, 7 ); }
return $slug;
}
add_filter( 'wp_unique_post_slug', 'change_events_slug', 10, 4 );
‘- This reply was modified 2 years, 1 month ago by patriqueuiliam.
I already found out. Thanks! Put in list.php
<?php $author = get_the_author(); echo $author; ?>
Forum: Plugins
In reply to: [Thumbs Rating] Is it possible to create a function to work on comments?Okay! Thank you very much, Ricard Torres!
I found a way to show the html inside TEXTARE in profile-events-create.php
The php code echo $pp_ec->description; does not render the html. So I called the content via $_GET[“eid”];Before
<textarea id=”event-description” class=”w3-input w3-border” name=”event-description”
php echo $pp_ec->description; ?
</textarea>Later
<textarea id=”event-description” class=”w3-input w3-border” name=”event-description” >
`php
$my_postid = $_GET[“eid”];
$content_post = get_post($my_postid);
$content = $content_post->post_content;
$content = apply_filters(‘the_content’, $content);
$content = str_replace(‘]]>’, ‘]]>’, $content);
echo $content;
?`
</textarea>Hello @shanebp! Sorry for the persistence in the question…
I can put html formatting in textarea. However, the
?php echo $pp_ec->description; ?
code does not print html on the page. I wanted it to print as it does if I use this codeecho get_post_field('post_content', $post->ID);
in single-event.phpI can create the event normally using html. But when editing, the html disappears. I can use the text editor. But in this case, it’s the code <?php echo $pp_ec->description; ?> which does not print html. How can I make print html on profile-events-create.php page?
Sorry for not being too clear. I’m using google translator.
Image:
https://drive.google.com/file/d/1fAILBX3R8RUwL8n-kNG602Ne_G_G8QV6/view?usp=sharingHi shanebp!
When I go to edit a published event, the html disappears. On the create event page.No show html:
<?php echo $pp_ec->description; ?>
Can you see this image?
Specific example:
https://drive.google.com/file/d/1d37QlRhbrNxl4sZZ6IfsFy7n_RJqlRrJ/view?usp=sharing<label for="event-description"><?php echo __( 'Description', 'bp-simple-events' ); ?>: *</label> <textarea id="event-description" name="event-description" ><?php echo $pp_ec->description; ?></textarea>
- This reply was modified 3 years, 8 months ago by patriqueuiliam.
- This reply was modified 3 years, 8 months ago by patriqueuiliam.
Forum: Plugins
In reply to: [BP Profile Search] Field to search users for a published post typeSolved by Andrea!!!
add_filter ('bps_add_fields', 'bps_posts_setup', 99); function bps_posts_setup ($fields) { $columns = array ( // 'ID' => 'integer', // 'post_author' => 'integer', 'post_date' => 'date', // 'post_date_gmt' => 'date', 'post_content' => 'text', 'post_title' => 'text', // 'post_excerpt' => 'text', 'post_status' => 'text', // 'comment_status' => 'text', // 'ping_status' => 'text', // 'post_password' => 'text', // 'post_name' => 'text', // 'to_ping' => 'text', // 'pinged' => 'text', // 'post_modified' => 'date', // 'post_modified_gmt' => 'date', // 'post_content_filtered' => 'text', // 'post_parent' => 'integer', // 'guid' => 'text', // 'menu_order' => 'integer', 'post_type' => 'text', // 'post_mime_type' => 'text', 'comment_count' => 'integer', ); $columns = apply_filters ('bps_posts_columns', $columns); foreach ($columns as $column => $format) { $f = new stdClass; $f->group = __('Posts data', 'bp-profile-search'); $f->code = $column; $f->name = $column; $f->description = ''; $f->format = $format; $f->options = array (); $f->search = 'bps_posts_search'; $fields[] = $f; } return $fields; } function bps_posts_search ($f) { global $wpdb; $column = $f->code; $filter = $f->format. '_'. ($f->filter == ''? 'is': $f->filter); $value = $f->value; $sql['select'] = "SELECT DISTINCT post_author FROM {$wpdb->posts}"; $sql['where'] = bps_where00 ($column, $filter, $value); $sql = apply_filters ('bps_field_sql', $sql, $f); $query = $sql['select']. ' WHERE '. implode (' AND ', $sql['where']); $results = $wpdb->get_col ($query); return $results; } function bps_where00 ($column, $filter, $value) { global $wpdb; $where = array (); switch ($filter) { case 'text_contains': $value = stripslashes ($value); $where[$filter] = bps_sql_expression ("{$column} LIKE %s", $value, true); break; case 'text_is': $value = stripslashes ($value); $where[$filter] = bps_sql_expression ("{$column} = %s", $value); break; case 'text_like': $value = str_replace ('\\\\%', '\\%', $value); $value = str_replace ('\\\\_', '\\_', $value); $where[$filter] = bps_sql_expression ("{$column} LIKE %s", $value); break; case 'integer_is': $where[$filter] = bps_sql_expression ("{$column} = %d", $value); break; case 'integer_range': if (isset ($value['min'])) $where['min'] = $wpdb->prepare ("{$column} >= %d", $value['min']); if (isset ($value['max'])) $where['max'] = $wpdb->prepare ("{$column} <= %d", $value['max']); break; case 'date_is': $where[$filter] = bps_sql_expression ("DATE({$column}) = %s", $value); break; case 'date_range': if (isset ($value['min'])) $where['min'] = $wpdb->prepare ("DATE({$column}) >= %s", $value['min']); if (isset ($value['max'])) $where['max'] = $wpdb->prepare ("DATE({$column}) <= %s", $value['max']); break; case 'date_age_range': $day = date ('j'); $month = date ('n'); $year = date ('Y'); if (isset ($value['max'])) { $ymin = $year - $value['max'] - 1; $where['age_min'] = $wpdb->prepare ("DATE({$column}) > %s", "$ymin-$month-$day"); } if (isset ($value['min'])) { $ymax = $year - $value['min']; $where['age_max'] = $wpdb->prepare ("DATE({$column}) <= %s", "$ymax-$month-$day"); } break; } return $where; }
CONTINUE IN: https://dontdream.it/support/forum/bp-profile-search-forum/
THANK YOU ANDREA!
- This reply was modified 3 years, 8 months ago by patriqueuiliam.
- This reply was modified 3 years, 8 months ago by patriqueuiliam.
Forum: Plugins
In reply to: [BP Profile Search] Field to search users for a published post typeHi Andrea! I took the tests and the results still don’t show up.
1) I installed a new WordPress for testing.
2) I created the bp-custom.php file and placed the function.
3) I created two publications and two users.
4) I created a simple form to search the post title and author name.
5) When I search for the post name, the results don’t appear.
6) Here is the test URL: https://newrel.com/testtest/members/
7) Here is the user… login: test password: pass
8) I don’t know how to resolve this issue. ??- This reply was modified 3 years, 8 months ago by patriqueuiliam.
Forum: Plugins
In reply to: [BP Profile Search] Field to search users for a published post typeHi Andrea! I just need this feature to finish my project. Could you help me with a simple function so I can do this, before you release a version with the feature?
Thanks!
- This reply was modified 3 years, 8 months ago by patriqueuiliam.
Forum: Plugins
In reply to: [BP Profile Search] Field to search users for a published post typeBest example:
The author of the post type publishes: “Tips on how to face the pandemic”
visitor search: Pandemic
And as a result all authors who published about pandemic appear in the buddypress directory
Forum: Plugins
In reply to: [BuddyPress Simple Events] Send notifications of new events to friendsOkay! Hi Shanebp! Thanks a lot for the help!
Forum: Plugins
In reply to: [BuddyPress Simple Events] Send notifications of new events to friendsHI @shanebp got part of the code. how do i make it work with events?
`// this is to add a fake component to BuddyPress. A registered component is needed to add notifications
function custom_filter_notifications_get_registered_components( $component_names = array() ) {
// Force $component_names to be an array
if ( ! is_array( $component_names ) ) {
$component_names = array();
}
// Add ‘custom’ component to registered components array
array_push( $component_names, ‘projectadd’ );
// Return component’s with ‘custom’ appended
return $component_names;
}
add_filter( ‘bp_notifications_get_registered_components’, ‘custom_filter_notifications_get_registered_components’ );// this hooks to post creation and saves the post id
function bp_custom_add_notification( $post_id, $post ) {
if ( $post->post_type == ‘project’ || $post->post_type == ‘bid’ ) {
$post = get_post( $post_id );
$author_id = $post->post_author;
bp_notifications_add_notification( array(
‘user_id’ => $author_id,
‘item_id’ => $post_id,
‘component_name’ => ‘projectadd’,
‘component_action’ => ‘projectadd_action’,
‘date_notified’ => bp_core_current_time(),
‘is_new’ => 1,
) );
}
}
add_action( ‘wp_insert_post’, ‘bp_custom_add_notification’, 99, 2 );// this gets the saved item id, compiles some data and then displays the notification
function custom_format_buddypress_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = ‘string’ ) {
// New custom notifications
if ( ‘projectadd_action’ === $action ) {$post = get_post( $item_id );
$custom_title = $post->post_author . ‘ add the project ‘ . get_the_title( $item_id );
$custom_link = get_permalink( $post );
$custom_text = $post->post_author . ‘ add the project ‘ . get_the_title( $item_id );
// WordPress Toolbar
if ( ‘string’ === $format ) {
$return = apply_filters( ‘projectadd_filter’, ‘‘ . esc_html( $custom_text ) . ‘‘, $custom_text, $custom_link );
// Deprecated BuddyBar
} else {
$return = apply_filters( ‘projectadd_filter’, array(
‘text’ => $custom_text,
‘link’ => $custom_link
), $custom_link, (int) $total_items, $custom_text, $custom_title );
}return $return;
}
}
add_filter( ‘bp_notifications_get_notifications_for_user’, ‘custom_format_buddypress_notifications’, 10, 5 );
wordpress- This reply was modified 3 years, 9 months ago by patriqueuiliam.
Forum: Plugins
In reply to: [BuddyPress Simple Events] Send notifications of new events to friendsAll that’s missing is to finish my project. I don’t know how to get friends to receive notification when they post an event. Please can you help me?
I’ve tried every possible way and I can’t. I’ve been looking for that answer for weeks.
I would like to pay the premium, however, in my country (Brazil), the dollar is very expensive and I cannot afford it.
So I just need this one help to finish.
I just need a simple code that notifies a user’s friends of a new event.
Forum: Plugins
In reply to: [BuddyPress Simple Events] Send notifications of new events to friendsfound part of the code. Now I need to put the POSTTYPE… How to do this?
`function bp_post_published_notification( $post_id, $post ) {
$author_id = $post->post_author; /* Post author ID. */
$users = get_users();/* Loop all users */
foreach( $users as $user ) {
if ( bp_is_active( ‘notifications’ ) ) {
bp_notifications_add_notification( array(
‘user_id’ => $user->ID,
‘item_id’ => $post_id,
‘component_name’ => ‘custom’,
‘component_action’ => ‘custom_action’,
‘date_notified’ => bp_core_current_time(),
‘is_new’ => 1,
) );
}
}
}
add_action( ‘publish_post’, ‘bp_post_published_notification’, 99, 2 );RESOLVIDO: Conflito com o Plugin “Remove Dashboard Access”. Quando você ativa este plugin, n?o autoriza a deletar o evento porque a URL “wp-admin/post.php?” impede acesso para deletar.
GOOGLE TRADUCTOR
SOLVED: Conflict with the “Remove Dashboard Access” Plugin. When you activate this plugin, you do not authorize to delete the event because the URL “wp-admin / post.php?” prevents access to delete.
- This reply was modified 4 years, 6 months ago by patriqueuiliam.