How can i desactive or delete Forum menu?
Quote from Adnan on May 23, 2019, 12:49 pmQuote from Asgaros on May 21, 2019, 12:31 pmHello @adnan
For translating-purposes I suggest you to use the following extension:
https://wordpress.org/plugins/loco-translate/
For getting all posts of a user I suggest you to use the following function:
global $asgarosforum; $posts = $asgarosforum->profile->get_post_history_by_user($user_id, $limit = false);
- global $asgarosforum;
- $posts = $asgarosforum–>profile–>get_post_history_by_user($user_id, $limit = false);
global $asgarosforum; $posts = $asgarosforum->profile->get_post_history_by_user($user_id, $limit = false);
@asgaros ย any example to use it? (i need to us it in a page out of asgaros plugin. i have a perfil page per user there i get (already done) post, comments, Q&A made by user in my web. I done care about CSS (i make it as my needs) only php snippets and the the count (count if is posible).
Thanks!
Quote from Asgaros on May 21, 2019, 12:31 pmHello @adnan
For translating-purposes I suggest you to use the following extension:
https://wordpress.org/plugins/loco-translate/
For getting all posts of a user I suggest you to use the following function:
global $asgarosforum; $posts = $asgarosforum->profile->get_post_history_by_user($user_id, $limit = false);
- global $asgarosforum;
- $posts = $asgarosforum–>profile–>get_post_history_by_user($user_id, $limit = false);
global $asgarosforum; $posts = $asgarosforum->profile->get_post_history_by_user($user_id, $limit = false);
@asgaros ย any example to use it? (i need to us it in a page out of asgaros plugin. i have a perfil page per user there i get (already done) post, comments, Q&A made by user in my web. I done care about CSS (i make it as my needs) only php snippets and the the count (count if is posible).
Thanks!
Quote from Asgaros on May 23, 2019, 9:24 pm@adnan Basically the code reads all the post-data from the database and saves it into the $posts variable.
I dont exactly know what you want to build and how the components are working which you want to use, but you can have a look into the following implementation (it is how this function is used inside of the profile, which you could use as a template):
https://github.com/Asgaros/asgaros-forum/blob/master/includes/forum-profile.php#L168
@adnan Basically the code reads all the post-data from the database and saves it into the $posts variable.
I dont exactly know what you want to build and how the components are working which you want to use, but you can have a look into the following implementation (it is how this function is used inside of the profile, which you could use as a template):
https://github.com/Asgaros/asgaros-forum/blob/master/includes/forum-profile.php#L168
Quote from Adnan on May 24, 2019, 12:11 amQuote from Asgaros on May 23, 2019, 9:24 pm@adnan Basically the code reads all the post-data from the database and saves it into the $posts variable.
I dont exactly know what you want to build and how the components are working which you want to use, but you can have a look into the following implementation (it is how this function is used inside of the profile, which you could use as a template):
https://github.com/Asgaros/asgaros-forum/blob/master/includes/forum-profile.php#L168
i want to get this list: https://asgaros.com/support/history/adnan/ ย for a custom post type i do something like this and get it any post type:
<?php $args = array( 'post_type' => 'dwqa-answer', 'author' => $user->id, 'post_status' => 'publish', 'posts_per_page' => 5, ); $wp_posts = get_posts($args); if (count($wp_posts)) { echo '<h3>Respuestas (' . $count1 . ')</h3>'; $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> <div class="post-title box"> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <em><?php the_time('Y-m-d g:i:s G') ?></em> <span><p><?php the_excerpt();?></p></span> </li> </div> <?php endwhile; wp_reset_postdata(); } ?>
Quote from Asgaros on May 23, 2019, 9:24 pm@adnan Basically the code reads all the post-data from the database and saves it into the $posts variable.
I dont exactly know what you want to build and how the components are working which you want to use, but you can have a look into the following implementation (it is how this function is used inside of the profile, which you could use as a template):
https://github.com/Asgaros/asgaros-forum/blob/master/includes/forum-profile.php#L168
i want to get this list: https://asgaros.com/support/history/adnan/ ย for a custom post type i do something like this and get it any post type:
<?php $args = array( 'post_type' => 'dwqa-answer', 'author' => $user->id, 'post_status' => 'publish', 'posts_per_page' => 5, ); $wp_posts = get_posts($args); if (count($wp_posts)) { echo '<h3>Respuestas (' . $count1 . ')</h3>'; $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> <div class="post-title box"> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <em><?php the_time('Y-m-d g:i:s G') ?></em> <span><p><?php the_excerpt();?></p></span> </li> </div> <?php endwhile; wp_reset_postdata(); } ?>
Quote from Adnan on May 24, 2019, 12:15 amI get all user posts, data, comments, Q&A and the asgaros forum is last step to end my perfil page ๐
I get all user posts, data, comments, Q&A and the asgaros forum is last step to end my perfil page ๐
Quote from Asgaros on May 24, 2019, 1:06 pmHi @adnan
You can use a loop on the forum-posts like the following:
global $asgarosforum; $posts = $asgarosforum->profile->get_post_history_by_user(12345, true); if (empty($posts)) { _e('No posts made by this user.', 'asgaros-forum'); } else { foreach ($posts as $post) { // Render your output here ... } }The 12345 example-ID must be replaced by the current user-ID of course. Inside of the foreach-loop you have to put your HTML to render the data.
Hi @adnan
You can use a loop on the forum-posts like the following:
global $asgarosforum; $posts = $asgarosforum->profile->get_post_history_by_user(12345, true); if (empty($posts)) { _e('No posts made by this user.', 'asgaros-forum'); } else { foreach ($posts as $post) { // Render your output here ... } }
The 12345 example-ID must be replaced by the current user-ID of course. Inside of the foreach-loop you have to put your HTML to render the data.
Quote from Adnan on May 24, 2019, 1:22 pmQuote from Asgaros on May 24, 2019, 1:06 pmHi @adnan
You can use a loop on the forum-posts like the following:
global $asgarosforum; $posts = $asgarosforum->profile->get_post_history_by_user(12345, true); if (empty($posts)) { _e('No posts made by this user.', 'asgaros-forum'); } else { foreach ($posts as $post) { // Render your output here ... } }
- global $asgarosforum;
- $posts = $asgarosforum–>profile–>get_post_history_by_user(12345, true);
- if (empty($posts)) {
- _e(‘No posts made by this user.’, ‘asgaros-forum’);
- } else {
- foreach ($posts as $post) {
- // Render your output here …
- }
- }
global $asgarosforum; $posts = $asgarosforum->profile->get_post_history_by_user(12345, true); if (empty($posts)) { _e('No posts made by this user.', 'asgaros-forum'); } else { foreach ($posts as $post) { // Render your output here ... } }The 12345 example-ID must be replaced by the current user-ID of course. Inside of the foreach-loop you have to put your HTML to render the data.
My problem was here “$user_id” it was always return 0, so i add $user_id = $user->id; and now i am getting user id correctly Thanks a Lot !! going to make the loop ๐ thanks again.
Quote from Asgaros on May 24, 2019, 1:06 pmHi @adnan
You can use a loop on the forum-posts like the following:
global $asgarosforum; $posts = $asgarosforum->profile->get_post_history_by_user(12345, true); if (empty($posts)) { _e('No posts made by this user.', 'asgaros-forum'); } else { foreach ($posts as $post) { // Render your output here ... } }
- global $asgarosforum;
- $posts = $asgarosforum–>profile–>get_post_history_by_user(12345, true);
- if (empty($posts)) {
- _e(‘No posts made by this user.’, ‘asgaros-forum’);
- } else {
- foreach ($posts as $post) {
- // Render your output here …
- }
- }
global $asgarosforum; $posts = $asgarosforum->profile->get_post_history_by_user(12345, true); if (empty($posts)) { _e('No posts made by this user.', 'asgaros-forum'); } else { foreach ($posts as $post) { // Render your output here ... } }The 12345 example-ID must be replaced by the current user-ID of course. Inside of the foreach-loop you have to put your HTML to render the data.
My problem was here “$user_id” it was always return 0, so i add $user_id = $user->id; and now i am getting user id correctly Thanks a Lot !! going to make the loop ๐ thanks again.
Quote from Asgaros on May 24, 2019, 2:58 pmI am happy to hear that the code is working well now! ๐
I am happy to hear that the code is working well now! ๐