Creating a functionality or process which allows client to approve comments - javascript

I recently completed a website, built in ReactJS, for a personal trainer.
Now my client is asking if its possible for me to allow his clients to submit a testimonial on the testimonial page and it can go on the website as an immediate update only after she has approved the comment.
I am still relatively new to backend. I do have knowledge of PHP, Python and a little NodeJs.
Can someone please let me know what in your opionion is the best approach for something like this?
Your help is greatly appreciated!

Approach -
In your testimonial table keep a field called approved and keep it false by default for all the records.
Now for the client Interface show all the testimonials created by the user and if the testimonial is good or can be approved set the state of approved to true.
Now while fetching the testimonials keep a check on the backend query like -
select * from testimonial where client=anyone and approved = true
Now the testimonials visible to users are only those which are approved.
But the client can see all the testimonials with status and you can provide actions to change the status on button click to true or false.

Related

SMS Personalization using AMPScript in Salesforce Marketing Cloud

My CRM team is running into problems when attempting to personalize SMS using AMPScript. The syntax used is as follows:
%%[
Var #subscriberKey
Set #subscriberKey = _subscriberKey
]%%
%%= v(#subscriberKey) =%%
Thank you for signing up for a 45 day risk-free hearing aid trial! One of our expert hearing consultants will call you soon to discuss next steps. During this call, we'll discuss your hearing loss situation and go over the details of the 45 day risk-free trial. We look forward to speaking with you shortly!
I have created a data extension in Marketing Cloud with just me in it, and used it on a journey that sends a text message with this content to my phone. The text message delivers, however the personalization content is not in there, just the plain text is shown. Of course, once the personalization works, we will change it so that other information is in there and not subscriberKey, but for now it would be a ton of help to know why the syntax is not working when it should.
Kind regards,
Michael
you will need to add the personalized field i.e. First Name/ Subscriber Key/etc in the following format %%FirstName%% . This field is actually picked up from the Attributed which are linked in your Contact Builder. Look for Mobile Connect Demographics, make sure these attributes which are trying to add in personalization are present there.
Now next step is how to link your information from your Master DE to the MobileConnect Demographics, for that u need to create an Import Activity from Contact Builder, and Import these details in a Mobile Connect List.
Hope this helps.
Mobile Connect Lists are different from Emails Studio Lists - Keep this in mind.

Paypal Express Checkout / React - Send Product Information

I'm working on a shop app that I want to use Paypal with to checkout.
I have installed this very nifty React implementation of the Express Checkout Button - https://www.npmjs.com/package/react-paypal-express-checkout
After setting up my merchant account, developer app, and sandbox accounts it was working right away.
The only issue I'm running into is that my app has a built-in cart; Keeping track of what items the user intends to purchase and what options they have selected for each one ( Color, size, quantity, etc ), and the seller needs to know this information so they can ship the correct products.
I was wondering if there is a way I could send some additional information with the purchase to let the seller know what products the user has purchased and what options they have selected. If somehow I could just send one extra string to appear in the seller's account I could easily attach the user's cart info.
Sorry if this is a noob-ish question. I am still fairly new to web-dev.
So I found in the documentation that you can send a table of items using item_list. With each item you can attach a name, as well as a list of options ( size, color, etc,. ) But I cannot find how to format this list in the documentation, and no one seems to know.
So as a workaround I am just attaching the options to the name so the buyer and seller can see a full list of every item and their options.
Here's what it looks like in your paypal transaction -
If anyone needs to use this I forked the node package above and implemented this functionality. Hopefully this can help someone trying to implement paypal into their react shop.

How could I manage permissions of jhipster's authorities?

I am coding a webapp using JHipster code generator.
I created 2 extra roles, now I have 5 in total:
ROLE_USER, ROLE_ADMIN, ROLE_ANONYMOUS, ROLE_PRESIDENT, ROLE_VICE_PRESIDENT
I was wondering how could I manage their permissions to show some RESTs.
For example, I would like to let the PRESIDENT add new users to database, other simple users should not see the web service that do the work.
Is there a file that I'm ignoring by mistake that could help me with this feature?
Giving thanks in advice for your precious time,
Manuel
Adding new roles to JHipster needs to be added in 2 places.
The obvious one is the AngularJS frontend. To add your new role to user edit view, you add them to the select options in "user-management.controller.js" at vm.authorities = ['ROLE_USER', 'ROLE_ADMIN']
To enforce the role at different places in UI, you either add your roles to the state JS files. Just add them to data.authorities (check user-management.state.js)
If you like to have a template block visible only if a user has the proper role, check out the hasAnyAuthority directive.
The other Part is to secure the backend. If using a current JHipster version and SQL database, authorities are stored in the database. Add your custom roles to authorities.csv of your liquibase migrations.
Last but not least, you can enforce roles in WebSecurityConfiguration or MicroserviceSecurityConfiguration (just look at the existing antMatchers)

how to assign admin functions to users

I have a site where every club member is free to register& login but cannot chat/or view other members profile without being confirmed by the admin. We are only 5 in admin level but people joining are too much for us.
My question is; I need a code which will enable any confirmed member to confirm two members.
Simply put: code to make 1 approve 2&3. 2 will approve 4&5.3 will approve 5&6. That means turn by turn work. A kind of 2:1 matrix. Anyone who have approved someone can't approve again. Thanks in advance.
When the user is approved he should be granted 2 approvals - as he can approve anyone you need to subtract the number of people he can approve after he does that. It would be pretty simple to do as you just need one extra column in the users table in the database.
As for the code that depends entirely on your application and you did not specify any details of it.

Password protection for a page with a simple function - what are the downsides?

I am doing work on an e-commerce platform, and I was asked to come up with a solution so that a certain group of customers could enter a password protected page on the site. The platform doesn't allow for this, as in the functionality is not available, so according to customer support, it's something you would have to create a custom template for and build from scratch. It doesn't need to be fancy, or hacker proof, just secure enough. So instead of doing that, I dropped the script below into the body of the page.
My first version: I use a prompt to ask for an input (password). If you click "prevent this page from creating additional dialouges", it creates sort of an infinite reload loop for that tab (not ideal, but problem?). Are there other serious problems? Easy hacks for your average person?
$("body").hide();
var passwordCheckFunction = function() {
var testPassword = window.prompt("YOU SHALL NOT PASS");
if (testPassword === "thisPredefinedPassword") {
$("body").show();
} else {
location.reload();
}
};
passwordCheckFunction();
Any advice would be much appreciated, and thank you for your time.
Create your secret page as a category.
Customize it to your heart's desire by choosing a custom template
file for it.
Finally, restrict it to only the authorized customer group
by removing it from view from guests and every group except the
authorized one.
Using this method, the customer only has to sign into his/her own customer account. BigCommerce will prevent access to the page by reading the assigned customer group of the customer.
I realize this isn't your desired method, but you might consider instead just making your page inactive in the admin area of your BC store, then instead of a password provide the direct url for users that are able to see that page.
I'm not sure about the implications for google indexing with an inactive page, but I would assume that they are set not to index it, and if not you could set it in robots.txt

Categories

Resources