Notifications
Clear all

Script [Solved] Register and pay to see a thread

30 Posts
2 Users
2 Reactions
2,303 Views
Posts: 16
Topic starter
(@vijeyraghavan)
Active Member
Joined: 3 years ago

I need to implement a payment gateway for viewing a thread, I was able configure till the image as attached. but htere I need to include payment details for the person to pay, after paying he can see the thread, I need this function for multiple forum threads too...

How do i do it. I have installed woo commerce too....

In the next register link I need to add pay now. how do i do it

Regards,

Vijey

 

29 Replies
Robert
Posts: 10549
Admin
(@robert)
Support Team
Joined: 8 years ago

@vijeyraghavan,

You should customize wpForo template file and insert different content for different forums by forum IDs. The forum IDs can be found in Dashboard > Forums > Forums admin page. Please follow the instruction below:

 

1. Create /wpforo/ folder in your current active WordPress theme, if you have a child theme then create it in the child theme folder.

2. Copy wp-content/plugins/wpforo/wpf-themes/classic/topic.php file and paste it in the newly created  /wpforo/ folder of the WordPress active theme.

3. Open the topic.php file which is located in the new folder and find this part (at the end of the file):

<p class="wpf-p-error">
<?php if(is_user_logged_in()): ?>
<?php echo apply_filters('wpforo_no_forum_access_message_for_users', wpforo_phrase("Your user level does not have appropriate permission to view the content", false)); ?>
<?php else: ?>
<?php echo apply_filters('wpforo_no_forum_access_message_for_guests', wpforo_phrase("You do not have permission to view the content", false) . '<br>'. wpforo_get_login_or_register_notice_text()); ?>
<?php endif; ?>
</p>

 

4. Change it to this:

<p class="wpf-p-error">
<?php if(is_user_logged_in()): ?>
<?php echo apply_filters('wpforo_no_forum_access_message_for_users', wpforo_phrase("Your user level does not have appropriate permission to view the content", false)); ?>
<?php else: ?>
<p><?php echo apply_filters('wpforo_no_forum_access_message_for_guests', wpforo_phrase("You do not have permission to view the content", false) . '<br>'. wpforo_get_login_or_register_notice_text()); ?></p>
<?php $ForumID = (int)wpfval(WPF()->current_object, 'forum', 'forumid'); ?>
<?php if( $ForumID === 5 ): ?>
<p>[Buy Now] button for forum ID #5</p>
<?php elseif( $ForumID === 8 ): ?>
<p>[Buy Now] button for forum ID #8</p>
<?php elseif( $ForumID === 10 ): ?>
<p>[Buy Now] button for forum ID #10</p>
<?php endif; ?>
<?php endif; ?>
</p>

You should add different content for different forums. I've added examples for Forum ID 5, 8 and 10. These are just examples. You should remove the ones you don't need and change the forum IDs to match your forum IDs.

Posts: 16
Topic starter
(@vijeyraghavan)
Active Member
Joined: 3 years ago

Hi,

Thanks a lot for the help, I did the below...

I copied the entire folder, from the plugins folder named : wpforo, and pasted in in the wordpress root folder.

I changed the code mentioned from step 3 to step 4....

But I am unable to find the forum Id in the topic.  - in my url I found in the url as ::: foro-forums&id=10&action=edit

But Its not working properly.... I did some mistake... Please advice.

Regards,

Vijey

Posts: 16
Topic starter
(@vijeyraghavan)
Active Member
Joined: 3 years ago

I am attaching a screenshot, I am unable to follow the link...  Dashboard > Forums > Forums admin page.

 

Unable to see the admin page..

Robert
Posts: 10549
Admin
(@robert)
Support Team
Joined: 8 years ago
Posted by: @vijeyraghavan

copied the entire folder, from the plugins folder named : wpforo, and pasted in in the wordpress root folder.

Why have you copied the entire folder? Please never do so, you should only copy the template file you want to customize, so please remove all copied folders and files and only leave the wp-content/plugins/wpforo/wpf-themes/classic/topic.php file.

 

Posted by: @vijeyraghavan

I am attaching a screenshot, I am unable to follow the link...  Dashboard > Forums > Forums admin page.

The Dashboard is your Dashboard, the Forum is the Forum Menu, the Forum > Forum is the Forum sub menu of the Forum menu. So just go to Forums > Forums admin page and find Forum IDs:

2 Replies
(@vijeyraghavan)
Joined: 3 years ago

Active Member
Posts: 16

@robert

Thanks Robert,

I did as per your guidance and I was able to achieve what i needed, But I am not getting the payment link of the payment button.

As per your guidance, I used the below code, I am not getting any payment button for that course... Need guidance.

I am attaching the screenshot for your reference.

 

<?php elseif( $ForumID === 10 ): ?>
<p>[Buy Now] button for forum ID #10</p>
Robert
Admin
(@robert)
Joined: 8 years ago

Support Team
Posts: 10549

@vijeyraghavan,

Please show a screenshot of the file system, so I can see where and what file have you used. Also, show me the screenshot of the whole code you got in the file.

And make sure you've deleted all caches before checking.

Also, please leave a direct link to that thread.

Page 1 / 2