View Single Post
  #4  
Old 11-08-2023, 09:30 PM
TheLastSuperman's Avatar
TheLastSuperman TheLastSuperman is offline
Senior Member
 
Join Date: Sep 2008
Location: North Carolina
Posts: 5,844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I agree with Hostboard - I don't recommend using vBSEO at all, so proceed and use at your own risk;

To convert an attachment URL into a vBSEO-friendly URL in vBulletin, you are on the right track by trying to utilize vBSEO's built-in functions to rewrite the URLs. However, it appears that you are encountering issues with Cloudflare errors and empty returns. Let's go through some steps that may help resolve these issues:

- Debug the Cloudflare Error:
Cloudflare errors typically indicate some problem with the server configuration or the way the request is being handled. Check your Cloudflare settings to ensure that you are not hitting a security rule that's causing the server error.
Look at the server logs to see if there's more information about the error. It could be that the make_crawlable function or some other part of your script is triggering a rule on Cloudflare's side.

- Correct Use of vbseo_output_handler:
It's important to ensure that the function vbseo_output_handler is designed to handle individual URLs, and not an entire array of URLs at once. If it's designed for individual use, you'll need to call it inside the loop for each attachment URL.
If the function works for the first URL but not subsequent ones, it might be a scoping issue or a problem with the way the loop is structured. Ensure that $temp is being properly reset at each iteration of the loop.

- Investigate vbseo_attachment_url Function:
If vbseo_attachment_url($attach['attachmentid']) is returning empty, it could be due to several reasons. The function might not be able to retrieve the necessary data from the database, or it might require additional parameters.
Check the definition of the vbseo_attachment_url function to ensure that you are using it correctly. There might be required parameters that you are missing or additional setup needed.

- Check vBSEO Documentation:
Refer to the vBSEO documentation for the correct usage of functions like make_crawlable and vbseo_output_handler. There might be specific instructions or prerequisites that you're overlooking.
*Finding official vBSEO documentation can be challenging since the official site is closed. However, some resources may still exist on the Internet Archive. You can search for vBSEO materials using the following link: Internet Archive Search for vBSEO using this link: https://archive.org/search.php?query...%3A%22VBSEO%22

- Ensure Proper Variable Interpolation:
Check that your PHP code is interpolating variables correctly in the string. Sometimes concatenation issues can cause the URL to be malformed, leading to errors.

- Review Server Configuration:
Since you're encountering server errors, it's also a good idea to review your PHP and server configurations. Ensure that the PHP version you are using is compatible with your vBulletin and vBSEO versions.

- Test with Error Reporting:
Enable error reporting in PHP temporarily to get more detailed errors. This can provide clues as to what is going wrong. Remember to turn this off in a production environment.

Here's a very basic example of how your loop should probably look (assuming vbseo_output_handler is the correct function to use):
Code:
foreach ($attachments as $attach) {
    $temp = "<a href=\"" . $vbulletin->options['bburl'] . "/attachment.php?attachmentid={$attach['attachmentid']}&amp;d={$attach['dateline']}\"></a>";
    $temp = vbseo_output_handler($temp, false);
    
    // Now $temp should contain the individual vBSEO-friendly URL
    $attach['full_res_src'] = $temp;
    
    // ... Do something with $attach['full_res_src']
}
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01222 seconds
  • Memory Usage 1,780KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete