Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted April 13, 20222 yr Hi, I want to change the title and text of the output modal of the confirmedDelete() method . I used this structrue but doesn't work \IPS\Request::i()->confirmedDelete( 'new_title', 'new_text' ); \\Doesn't work
April 13, 20222 yr /** * Confirmation check * * @param string $title Lang string key for title * @param string $message Lang string key for confirm message * @param string $submit Lang string key for submit button * @param string $css CSS classes for the message * @return bool */ public function confirmedDelete( $title = 'delete_confirm', $message = 'delete_confirm_detail', $submit = 'delete', string $css = 'ipsMessage ipsMessage_warning' ) { It should work. Bug? Edited April 13, 20222 yr by DawPi
April 13, 20222 yr In case you are trying to pass raw text it won't work, the code accepts only language keys. You can work around it doing something like this though: //<?php # First setup the language keys here \IPS\Member::loggedIn()->language()->words['new_title'] = "My New Title"; \IPS\Member::loggedIn()->language()->words['new_text'] = "My New Text"; # Then call confirmDelete() \IPS\Request::i()->confirmedDelete( 'new_title', 'new_text' ); Or just add the language keys to your app/plugin. 😋 Edited April 13, 20222 yr by teraßyte
April 13, 20222 yr Author 37 minutes ago, teraßyte said: In case you are trying to pass raw text it won't work, the code accepts only language keys. You can work around it doing something like this though: //<?php # First setup the language keys here \IPS\Member::loggedIn()->language()->words['new_title'] = "My New Title"; \IPS\Member::loggedIn()->language()->words['new_text'] = "My New Text"; # Then call confirmDelete() \IPS\Request::i()->confirmedDelete( 'new_title', 'new_text' ); Or just add the language keys to your app/plugin. 😋 Doesn't work!! i didn't use raw text, are lang keys, btw Edited April 13, 20222 yr by ReyDev
April 13, 20222 yr Author 1 minute ago, teraßyte said: What is your full code? public function delete() { \IPS\Session::i()->csrfCheck(); \IPS\Request::i()->confirmedDelete( 'new_title', 'new_text' ); //Some code } new_title and new_text are language keys in my app.
April 13, 20222 yr That code definitely looks okay. Not really sure why it isn't working. 🤔 Maybe something else is preventing it from running. Do you have any php error logged perhaps?
April 13, 20222 yr Author 2 minutes ago, teraßyte said: That code definitely looks okay. Not really sure why it isn't working. 🤔 Maybe something else is preventing it from running. Do you have any php error logged perhaps? thanks for your help