Send public link by email - alfresco

i am facing a little problem with email template in Alfresco Share. I want to send document's public link to users when somthing is uploaded.
The question is: how to include public link of a shared document in email template?
what freemarker data tag references the public link?

In Share 4.2f under path
share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\head\ resources.get.html.ftl
you have constant Alfresco.constants.QUICKSHARE_URL built like
Alfresco.constants.QUICKSHARE_URL = "${config.scoped["Social"]["quickshare"].getChildValue("url")?replace("{context}", url.context)?js_string}";
Didn't use it, but I'll bet you can do it first! ;)

Related

Restrict access to comments in WordPress using the plugin Restrict Content Pro

I would like to ask if someone can help me with this question. I can't find anywhere how to do it.
I have a website with Wordpress as a CMS. I use the plugin Restrict Content Pro to restrict access to exclusive content.
I share the post in freemium mode.
And now the question:
How could I restrict access to post comments?
I guess through something in the php code, but I don't know how.
Can anybody help me?
Thank you!
I don't use this plugin myself, but just found a good looking tutorial. Apparently, you restrict access to comments in the same way that you restrict access to anything else: By only outputting it in the theme files when the user has access to it. For example, the TwentyTwentyOne theme has a file "comments.php", which starts like this:
/*
* If the current post is protected by a password and
* the visitor has not yet entered the password,
* return early without loading the comments.
*/
if ( post_password_required() ) {
return;
}
$twenty_twenty_one_comment_count = get_comments_number();
?>
You can easily add another check beneath the password check:
/**
* Check if the user has access, don't output the comments if they don't.
*/
if ( !rcp_user_has_active_membership() ) {
return;
}
Of course, instead of returning you can also output something along the lines of "get a membership to see the comments".
The tutorial I found lists different ways to check for a membership, a paid membership and more special checks.
Two more things:
Be sure to check if there are other places where comments are displayed. That very much depends on how the WordPress theme is built.
Don't just change the theme if it comes from an external source, e.g. if it might receive updates in the future. In that case create a child theme and make your changes there instead. You can read more about child themes in the Theme Handbook.

Prestashop 1.7 override front controller from custom theme

In PrestaShop 1.7, I have my own theme, which is currently the default.
In the product card, I need to display a list of multishop stores.
Since I don't know if it is possible to get information about multishop stores using the default controller controllers/front/ProductController.php, I want to extend this controller in my custom theme.
I am creating file themes/myTheme/override/controllers/front/ProductController.php with code like this:
class ProductController extends ProductControllerCore{
public $multiStores;
public function init()
{
parent::init();
echo 'test';
}
}
I expect that on the product card page I will be able to see my text "test".
But unfortunately nothing happens, I conclude that this controller is not connected for some reason.
Can you please tell me what I'm doing wrong and how to fix the situation?
You cannot override a front controller method in a theme like that.
You'll need to override the core frontcontroller by placing
your code inside /override/controllers/front
See : https://devdocs.prestashop.com/1.7/modules/concepts/overrides/
Anyway you can achieve the desired result in a cleaner way by
using a proper frontend hook (ie. hookDisplayHeader) and build a simple module, checking the context object to see in which id_shop you are connected.

SilverStripe field-level Page editing permissions

I need to implement field-level permissions in a Page model, in a SilverStripe 3.2 website.
Let's imagine I have an ArticlePage.php model. It has the usual fields like $MenuTitle and $Content, and I've added other properties like $Subtitle and $Author.
I can protect the whole model by using providePermissions() and the associated canEdit() methods, but I need to protect individual fields / page properties.
What I need to do is:
Admins should be able to edit all fields
Users in another permissions group should only be able to edit and save $Subtitle
Is this possible in SilverStripe 3.2? Is there a SilverStripe way of doing it?
If not, is there a way I can Identify the user group of the current user and then perhaps conditionally show the $field->addFieldToTab() code? Is it possible to stop the user saving a field by posting the data maliciously, perhaps by adding the missing fields via inspector?
Thanks in advance.
So here's my own answer. This post was helpful: https://www.silverstripe.org/community/forums/customising-the-cms/show/11693
You can conditionally show CMS fields and tabs using code like the post demonstrates:
public function getCMSFields()
if(!Permission::check('PERMISSION_LABEL'){
$fields->removeFieldFromTab("Root.Main","MenuTitle");
$fields->removeByName('BannerImages');
// etc...
}
// etc...
}
Having defined the permission:
public function providePermissions()
{
return array(
'PERMISSION_LABEL' => 'Can edit some fields',
);
}
My concern with this approach was that a user could still create a form field on the page using inspector or JS and submit values for fields they should not be able to see.
Having tested this it appears that field values are not saved if they are not listed on the page, but are sent with the POST data. Although I'd love to know if a SilverStripe expert could confirm that.

Is it OK to wire routing-generale methods into the view?

many times I see, for example in Symfony:
html file:
<hr>
<?php $this->generateUrl('blog_show', array('slug' => 'slug-value')); ?>
<br>
this is a bad smell, like not using depencency injection: this way HTML is coupled to the current framework. I have to edit it if I want to move it to another framework.
Wouldnt it be better to just pass the generated url string from the controller?
You can separate your view from your backend as you want, but your frontend file has to refer to an url at some point, even if it is just an api.
Changing your url from <?php $this->generateUrl('blog_show', array('slug' => 'slug-value')); ?> to <?php $showUrl; ?> just make it less maintainable and harder to migrate to another framework.
If you want to be Framework Independant you should use Symfony backend like an API.
The url could be generated in the controller to separate model from view. But it's only a first step. The best way is to separate model, view and routing. I think the best way is to use a view helper which generates the path. I changed some framework for project (abandonware to symfony). It is easier when the project used a template (like Smarty or Twig)
Take a look at Symfony Twig extensions to have some example which separates path generation and controller.
As example, Twig purpose the path method. This view helper is searching the url path from the route paramter. It doesn't have any relation with controller or model.
path : Returns the relative URL (without the scheme and host) for the given
route. If relative is enabled, it'll create a path relative to the
current path.
As you can see there you only have to be carefull to the route name.
/**YourController**/
/**
* #Route("/foo", name="new-game", methods="get")
*
* #return Response
*/
public function myFooAction()
{
//Your code
//The rendering without information about his own or other path
return $this->render('default/foo.html.twig', []);
}
And the corresponding path in Twig :
<hr>
Some text
<br>

how to change the link in the wordpress email with newpassword?

how to change the link in the wordpress email with newpassword?
this information we get when we click on forgot password.
username : admin
password : admin
http://www.example.com/wp-login.php
here i want to change this url "http://www.example.com/wp-login.php" and set my own url... how can i do?
some reference code:
if ( !function_exists('is_user_logged_in') ) :function is_user_logged_in() {
$user = wp_get_current_user();
You can hook into the retrieve_password_message filter
function someFunction($message, $key){
}
add_filter('retrieve_password_message', 'someFunction');
You would then have to use the "someFunction" function to parse the $message variable and change the link.
The message variable contains the entire message. So you could simply trim the message based on the number of characters then tack on your new link...
HTH
(Untested)
Using hooks would be my first thought so that you wouldn't have to edit any core files, however I have used the SB Welcome Email Editor plugin a couple times for this exact reason. Their are a couple plugins like this out their and they are fairly light weight and allow full customization of all Wordpress generated emails.
Try using a plugin such as Theme My Login, which does everything for you.
Editing core wordpress files is never a good idea, when updating wordpress, you'll loose all your work.
You can simply follow steps if you want to edit your code file.
Go to your wordpress folder. Look for the following files:
1. /wp-login.php
2. /includes/functions.php
Change the all the codes which contains wp-login.php into your custom URL.
for example: admin.php or client-login.php
Now you can changed your login/signup URL into your custom URL.
Known issue: You can find some database error if you make any mistakes. Just refresh the page and try with the customized Url it will work...
Example site I used here : http://androideveloper.com/admin.php from http://androideveloper.com/wp-login.php
Cheers.

Resources