• Resolved JTMVK

    (@jtmvk)


    the best plugin sam broadcaster, this amazing congratulations.

    I want to customize error messages.
    I have this:

    case 601 : $request_status_message = "Song recently played."; break;
    case 602 : $request_status_message = "Artist recently played."; break;
    case 603 : $request_status_message = "That Song is already in queue to be played."; break;
    case 604 : $request_status_message = "Sorry, that Artist is already in queue to be played."; break;
    case 605 : $request_status_message = "Sorry, that Song or that Title is already in request list."; break;
    case 606 : $request_status_message = "Sorry, that Artist is already in request list.  Please see our request policy for details"; break;
    case 609 : $request_status_message = "Sorry, that track has played within the last 24 hours and cannot be requested at this time"; break;

    What change in the “request.php” file for this to work with new messages?

    https://www.ads-software.com/plugins/ngs-sam-integrator/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Steve Williams

    (@netguysteve)

    If you are certain that those are the status codes that SAM throws in those cases, you can add those lines into the existing case structure around line 77. In order for that to be called however, you will need to make one more small change to actually throw an error for those status codes.

    At line 59, you will see:

    if ( 200 == $request_status_code )
    	require_once dirname( __FILE__ ).'/request-success.php';
    else
    	require_once dirname( __FILE__ ).'/request-failure.php';

    Change this to read:

    if ( 200 == $request_status_code )
    	require_once dirname( __FILE__ ).'/request-success.php';
    else if ( 599 < $request_status_code && 700 > $request_status_code )
    	ngs_sam_error( $request_status_code );
    else
    	require_once dirname( __FILE__ ).'/request-failure.php';

    This will convert the status codes from SAM between 600 and 699 into error codes in the plug-in and should override the error messages generated by SAM Broadcaster.

    Please let me know if this works or if you have any other questions.

    Steve

    Thread Starter JTMVK

    (@jtmvk)

    hi thanks for the prompt reply.

    the code deletes the default error message, but does not replace with new custom messages

    Plugin Author Steve Williams

    (@netguysteve)

    Okay. That sounds like a problem in my error trapping code which I need to correct anyway. Lemme look into this and will put an update out later today. In fact, I may go ahead and incorporate customizable error messages into the update.

    Thread Starter JTMVK

    (@jtmvk)

    wait for the update.
    thank you very much for the great work.

    Plugin Author Steve Williams

    (@netguysteve)

    STATUS UPDATE:

    I found and corrected the problem in the error trapping code. In the process, I found (and resolved) the hiccup with using localhost as the SAM host. That patch is now out as 1.1.1. I will work on adding customizable status messages and release THAT update as 1.2 as soon as it’s ready.

    The update will replace both request.php and request-failure.php, so if you want to add your custom messages back before 1.2 is released (likely later today or tomorrow), you will need to add back in the code from earlier.

    Thread Starter JTMVK

    (@jtmvk)

    excellent, I give you a list of the most common mistakes:

    case 600 : $request_status_message = "Requested song is offline and can not be played"; break;
      case 601 : $request_status_message = "Song recently played."; break;
      case 602 : $request_status_message = "Artist recently played."; break;
      case 603 : $request_status_message = "That Song is already in queue to be played."; break;
      case 604 : $request_status_message = "Sorry, that Artist is already in queue to be played."; break;
      case 605 : $request_status_message = "Sorry, that Song or that Title is already in request list."; break;
      case 606 : $request_status_message = "Sorry, that Artist is already in request list.  Please see our request policy for details"; break;
      case 609 : $request_status_message = "Sorry, that track has played within the last 24 hours and cannot be requested at this time"; break;
      case 610 : $request_status_message = "Guests can only request 1 song per hour.  To avoid this message, please register and or log in.";  break;
      case 611 : $request_status_message = "Sorry, you can only have 5 songs in the request queue at one time.";  break;
      case 612 : $request_status_message = "Sorry, you can only request a maximum of 15 songs in any 24 hour period.";  break;
      case 613 : $request_status_message = "Sorry, on Tuesdays you can only request a maximum of 2 songs per hour.";  break;
      case 614 : $request_status_message = "Sorry, on Tuesdays you can only request a maximum of 25 songs in the last 24 hour period.";  break;
      case 615 : $request_status_message = "Sorry, that artist is already in the Request Queue";  break;
      case 616 : $request_status_message = "Sorry, you can only request the same song once every 24 hours";  break;
      case 617 : $request_status_message = "Sorry, the request queue is currently full, please try again later"; break;
      case 618 : $request_status_message = "Sorry, you do not have enough points to make this request.  Rate more songs to increase your points"; break;
      case 619 : $request_status_message = "Sorry, Guests are not permitted to request songs"; break;
      case 620 : $request_status_message = "This is an invalid request, please contact the site administrator"; break;
      case 621 : $request_status_message = "Sorry, You've reached your request queue limit, please try again later"; break;
      case 700 : $request_status_message = "Demande Invalide - Invalid Request."; break;
      case 701 : $request_status_message = "Banned - Impossible"; break;
      case 702 : $request_status_message = "Banned until mm:ss";  break;
      case 703 : $request_status_message = "Requested song ID invalid.";  break;
      case 704 : $request_status_message = "Request limit reached.  You can only request 5 songs per hour";  break;
      case 705 : $request_status_message = "Request limit reached.  You can only request 15 songs per day."; break;
      case 706 : $request_status_message = "Requests are disabled -- Special Program -- Try again a little later."; break;
      case 707 : $request_status_message = "Authorization failed.  IP not in allowed list.";  break;
      case 708 : $request_status_message = "You have already request this song !!!";  break;
      case 709 : $request_status_message = "Invalid data returned!";  break;

    Excuse me, but I’m excited, no doubt this is the best wordpress plugin this year, for those who work in radio is fantastic.

    Plugin Author Steve Williams

    (@netguysteve)

    Okay. 1.2.0 is uploaded, I have NOT marked it as stable yet, so for the moment, you will need to download it manually and upload it to your site. To do this, go to the “Development” tab for the plug-in and you will see 1.2.0 listed under “Other Versions”. Note that since 1.1.1 is still marked as the latest stable version, you will get a message that a newer version is available after you install this.

    The custom status messages are set directly in your configuration options for the plug-in. I included customizable status messages for 601-606 and 609. There are some messages that it is best not to try to replace manually (such as if the user has made too many requests). The reason for this is, the messages sent by SAM include specific numbers from your SAM Request Policy (like the number and frequency of requests). There’s no way to pull this information from anywhere else, so (short of trying to capture them via a string search of the message sent by SAM), that information would be lost and would need to manually be put into the custom message.

    I am still seeing some odd behavior with the custom messages. Specifically, it seems to be always kicking the “artist” code, even if it’s the “title” that is being repeated. Looking into this further and will mark it as stable once this is resolved. I just wanted to get something out there for you.

    Plugin Author Steve Williams

    (@netguysteve)

    Annndd…. Fixed. REALLY REALLY silly mistake on my part. If you’ve already grabbed 1.2.0, just grab it again and all should be well. If you haven’t just stand by and it should show as the latest stable in the next few minutes.

    Thread Starter JTMVK

    (@jtmvk)

    thanks for the update.
    the plugin works fine.

    I just put the other errors in the script and adapt it to what I wanted and is ok. XD

    Sorry did not speak English I have to translate the plugin to Spanish.
    please do not stop working on this project is really good.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Customize Error Messages’ is closed to new replies.