SMF moderators can change their post count - forum

I have an SMF forum currently running on SMF 2.0RC4 and the moderators can change their post count. This is not a big problem as it's only available for the mods, but still I would like to know where I can change this. I found some settings in permissions settings, but when disabled, they could not change anything in the profile.

You can hack your way out of it.
In ./Sources/Profile-Modify.php on line 568
'posts' => array(
'type' => 'int',
'label' => $txt['profile_posts'],
'log_change' => true,
'size' => 7,
'permission' => 'moderate_forum'
Change 'permission' => 'moderate_forum' to 'permission' => 'admin_forum'.
Then only admins can edit the post count.

Related

Stripe full redirect method Change back button text currently showing site domain

I am trying to create api where different sites will use our api which will generate a token and they will use that token to redirect the user
I am using this code
$checkout_session = \Stripe\Checkout\Session::create([
'customer_email' => $customer_email,
'payment_method_types' => ['card'],
'line_items' => [[
'price_data' => [
'currency' => 'dkk',
'unit_amount' => $course_price,
'product_data' => [
'name' => $course_title,
'images' => [$course_image],
],
],
'quantity' => 1,
]],
'mode' => 'payment',
'success_url' => $success_url,
'cancel_url' => $cancel_url,
]);
I want to make the back button dynamic is it possible?
Not possible. The Checkout Session is created using your account's public key. So naturally, the "back" button on the Checkout page will show your domain.
What you can change however, is the text of the payment button (although not as flexible as you'd wish): https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-submit_type
Changing the name for a single account is not possible as it was in the old stripe version. But in the Stripe session checkout, if you are having multiple connected accounts, you can change the Public business name (if you have access, otherwise ask account owner) to whatever the business wants from the stripe portal https://dashboard.stripe.com/settings/account.

Stripe Checkout and Customer Creation

I was having some difficulties figuring out how to add a customer and card with no charge to Stripe using the API where I think I came across a solution that seems to work but am not sure if I am creating issues that I cannot see.
What I am doing is using the Checkout option with strip and in my charge.php file I am deleting the below code so that no charge is made:
$charge = \Stripe\Charge::create(array(
'customer' => $customer->id,
'amount' => 5000,
'currency' => 'usd'
));
I am only keeping the below code:
$customer = \Stripe\Customer::create(array(
'email' => 'customer#example.com',
'source' => $token
));
As far as I can tell, the customer is being created, I can use that customer data to charge the card in the future and no charge is being made to the card when they submit the form.
Am I missing something here?
As per the documentation here https://stripe.com/docs/charges#saving-credit-card-details-for-later - it's possible to store the customer's card details for a future date.
Using the following will store the customer and their card details for later:
$customer = \Stripe\Customer::create(array(
'email' => 'customer#example.com',
'source' => $token
));
Nothing else is needed. When you get ready to charge the customer in the future, you'll fetch their data (via their customer ID), and then run the following code:
$charge = \Stripe\Charge::create(array(
'customer' => $customer->id,
'amount' => 9999,
'currency' => 'usd'
));

TYPO3 backend: search custom records

I developed an extension which allows creation of new records.
In List module, under the records list, there is the Search form.
It works with fe users for example, but not with my custom records.
Is there any special configuration that I have to add in my tca to make this form work with my custom records?
EDIT: This seems to be happening after updating to TYPO3 4.6. In the previous version, 4.3.3, it works.
Thanks.
Edit ext_tables.php file in typo3conf/ext/yourext directory, find your table, and add to its ctrl section searchFields property as comma separated list of fields to search in:
$TCA['tx_yourext_table'] = array(
'ctrl' => array(
'title' => 'Title of your table',
'label' => 'title',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
// etc...
'searchFields' => 'title, other_field, yet_other_field',
),
);
Don't forget to clear all caches after that, works at 4.6.3
There's official information when and why it was changed

Bootstrap needs extra routes for controllers not caught by default rule in Kohana 3.2

I have multiple controllers in my Kohana 3.2 project where the routes where initially:
Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'user',
'action' => 'index',
));
It was working fine for all my new controllers (when I added a new file and went to: domain/controller it worked like a charm.
Now for a specific controller called parents I had to add new lines in my bootstrap:
Route::set('parents', '(<controller>(/<action>))')
->defaults(array(
'controller' => 'parents',
'action' => 'index',
));
Route::set('parent', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'parent',
'action' => 'index',
));
I was trying to access both: /parents/ and /parent/index/id and both generated an error when not having the Route::set in place.
Without those lines, I always got errors like:
unable to find a route to match the uri
OR
The requested route does not exist
How am I supposed to do it? For every controller that I add do I need to define it in my bootstrap?
Actually you'd be covered with just the default route in your case.
Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'user',
'action' => 'index',
));
First, Kohana tries to match against your regex pattern [((/(/)))]. This will match the urls: users, users/delete, users/delete/1, parents, parents/view, parents/view/2, etc.
If Kohana is unable to find the action, it will default to index based on your defaults array rule. If Kohana is unable to find a controller (which essentially means nothing passed), then it will use controller. In the last case, it would also default the action since we can't pass an action without passing a controller in our regex (see the parenthesis requires a controller first then action then id).
So the following examples will route through this default pattern:
URL: /users
Controller: users
Action: index (picked default)
URL: /users/kill/1
Controller: users
Action: kill
Id: 1
URL: /parents
Controller: parents
Action: index (picked default)
URL: /parent/view
Controller: parent
Action: view
Best practice is to keep this route as the last route applied (essentially the default and catch all) and if you have urls that don't match the pattern in the default, add them.
I'd better use one route for all this:
Route::set('p', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'action' => 'index',
));
If you call /parents/father - you get to parents controller, if you call /parent/father you get to parent

Have subdirectory with controllers in Kohana Framework

Ok so it used to be in application/controller/classes/ where my controllers are.
Now i would like to have better structure, so i moved my user controllers to the user/ directory.
So this:
Route::set('user', 'user(/<action>)')
->defaults(array(
'controller' => 'user',
'action' => 'index',
));
Got changed to:
Route::set('user', 'user(/<action>)')
->defaults(array(
'directory' => 'user',
'controller' => 'user',
'action' => 'index',
));
Now i receive error, e.g user/login not found.
The controller for the above example, is in application/controller/classes/user/user.php.
I tried to remove the bottom default route just in case it was going through that, but no it still doesnt not work.
Have you changed name of your controller class? The directory name must be in the controllers name, in your case it should be Controller_User_User.

Resources